﻿'********************************************************************************
'*
'*      マスタ履歴　フォーム
'*
'*      File Name : frmKindSwapMold.vb
'*      Title     : モールド品種切替画面
'*      機能    　：モールド品種切替
'*
'********************************************************************************
'----------------------------------<<修正履歴>>----------------------------------
'ﾊﾞｰｼﾞｮﾝ   日付       作業者        ｺﾒﾝﾄ
'--------- ---------- ------------ -----------------------------------------------
' V1.0.0   2016/12/26 S.Yu         新規作成
'********************************************************************************
Public Class frmKindSwapMold

#Region "定数・変数"
    Private Const TAB_TOP As Integer = 100
    Private Const TAB_LEFT As Integer = 7
    Private Const CELL_HEIGNT As Integer = 56
    Private Const CELL_WIDTH_HALF As Integer = CELL_WIDTH0 / 2
    Private Const CELL_WIDTH0 As Integer = 80
    Private Const CELL_WIDTH1 As Integer = CELL_WIDTH0 * 2
    Private Const CELL_WIDTH2 As Integer = 250
    Private Const CELL_WIDTH3 As Integer = 300

    Private ReadOnly CELL_COLOR_TITLE As Color = Color.LightGreen
    Private ReadOnly CELL_COLOR_NORMAL As Color = SystemColors.ButtonHighlight
    Private ReadOnly CELL_COLOR_CONTROL As Color = SystemColors.Control
    Private ReadOnly CELL_COLOR_TENKEY As Color = Color.Yellow

    Const szTagSeries = "Series"
    Const szTagEquipID = "EquipID"
    Const szTagProcs = "Procs"
    Const szTagLotNo = "LotNo"
    Const szTagBeginTM = "BeginTM"
    Const szTagEndTM = "EndTM"
    Const szTagDate = "Date"

    Private Enum MoldSeries
        ATOM_100PF
        ATOM_500F
        ATOM_FX_FS
        ATOM_FZ
        G_LINE
        Y_PC
        YPM
        YPS
        PMC
        YPM_MAP
        YPS_MAP
        YPS_MAP2
    End Enum

    Private m_MoldSeries As MoldSeries

    Private m_cTenken As New clsDbTenkenList
#End Region

#Region "LOAD/UNLOAD、共通"

    Private Sub frmKindSwapMold_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        bccEquipID.Text = g_CURRENT_EQUIP_ID
        ltlPinPrev.BorderStyle = BorderStyle.None
        ltlPinNew.BorderStyle = BorderStyle.None

        AddHandler ltlFreq.Click, AddressOf LiteralLabel_Click
        AddHandler lblLimitTime.Click, AddressOf TenKeyLabel_Click

        'm_MoldSeries = MoldSeries.YPM
        SetSeries()

        InitTabTool()
        InitTabCond()
        InitTabTemp()
        InitTabClean()
        InitTabCelRp()
        InitTabXray()
        InitTabPin()
        InitTabTB()
        InitTabEntity()
        InitTabProd()
    End Sub


    Public Sub CallTenkey(ByRef lblInput As TenKeyLabel, Optional ByVal iLeft As Integer = 0, Optional ByVal iTop As Integer = 0)
        'Me.Focus()
        Dim tk As New TenKey(lblInput)
        'Dim pos As New Point(iLeft, iTop)
        'iDifTop = lblInput.Parent.Top
        tk.Top = iTop + lblInput.Height / 2
        tk.Left = iLeft
        If tk.Right > Me.Width Then
            tk.Left = Me.Width - tk.Width - 50
        End If
        If tk.Bottom > Me.Height Then
            tk.Top = iTop - tk.Height - lblInput.Height
        End If

        'tk.Location = pos
        Me.Controls.Add(tk)
    End Sub

    Private Sub TenKeyLabel_Click(ByVal sender As Object, ByVal e As EventArgs)
        Dim tkl As TenKeyLabel = CType(sender, TenKeyLabel)
        Dim pt2Screen As Point = tkl.PointToScreen(New Point(0, 0))
        CallTenkey(tkl, pt2Screen.X - Me.Left, pt2Screen.Y - Me.Top)
    End Sub

    Private Sub LiteralLabel_Click(ByVal sender As Object, ByVal e As EventArgs)
        'Me.Focus()
        Dim ltl As LiteralLabel = CType(sender, LiteralLabel)
        Dim tkl As TenKeyLabel = ltl.InputLabel
        Dim pt2Screen As Point = tkl.PointToScreen(New Point(0, 0))
        CallTenkey(tkl, pt2Screen.X - Me.Left, pt2Screen.Y - Me.Top)
    End Sub

    Private Sub SmallLiteralLabel_Click(ByVal sender As Object, ByVal e As EventArgs)
        'Me.Focus()
        Dim sll As SmallLiteralLabel = CType(sender, SmallLiteralLabel)
        Dim tkl As TenKeyLabel = sll.InputLabel
        Dim pt2Screen As Point = tkl.PointToScreen(New Point(0, 0))
        CallTenkey(tkl, pt2Screen.X - Me.Left, pt2Screen.Y - Me.Top)
    End Sub

    Private Sub AppearenceResult_Click(ByVal sender As Object, ByVal e As EventArgs)
        'Me.Focus()
        Dim apr As AppearenceResult = CType(sender, AppearenceResult)
        Dim tkl As TenKeyLabel = apr.InputLabel
        Dim pt2Screen As Point = tkl.PointToScreen(New Point(0, 0))
        CallTenkey(tkl, pt2Screen.X - Me.Left, pt2Screen.Y - Me.Top)
    End Sub

    Private Sub tklDate_Click(ByVal sender As Object, ByVal e As System.EventArgs)
        'Me.Focus()

        Dim tkl As TenKeyLabel = CType(sender, TenKeyLabel)
        Dim frmDate As New frmDateTime(tkl.InputLabel)
        frmDate.ShowDialog()
        tkl.EndEdit()
    End Sub

    Private Sub tk_InputEnd(ByVal sender As Object, ByVal e As System.EventArgs)

    End Sub

    Private Sub SetSeries()
        Dim i As Integer
        Dim dtSeries As New DataTable
        dtSeries.Columns.Add("Value", 0.GetType)
        dtSeries.Columns.Add("Series", "".GetType)
        For i = 0 To MoldSeries.YPS_MAP2
            Dim drNew = dtSeries.NewRow
            drNew("Value") = i
            drNew("Series") = CType(i, MoldSeries).ToString
            dtSeries.Rows.Add(drNew)
        Next
        cbSeries.DisplayMember = "Series"
        cbSeries.ValueMember = "Value"
        cbSeries.DataSource = dtSeries

        cbSeries.SelectedValue = 0
    End Sub

    Private Sub cbSeries_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cbSeries.SelectedIndexChanged
        m_MoldSeries = cbSeries.SelectedValue

        SetTabTool()
        SetTabCond()
        SetTabTemp()
        SetTabClean()
        SetTabCelRp()
        SetTabXray()
        SetTabPin()
        SetTabTB()
        SetTabEntityHis()
        SetTabProdHis()
    End Sub
#End Region

#Region "金型確認"

#Region "表示内容"

    Protected btnSaveTool As Button
    Private Sub SetTabTool()
        tabTool.Controls.Clear()
        Select Case m_MoldSeries
            Case MoldSeries.ATOM_100PF
                SetToolAtom100pf_500f()
            Case MoldSeries.ATOM_500F
                SetToolAtom100pf_500f()
            Case MoldSeries.ATOM_FX_FS
                SetToolFx_Fz_G_YPC_YPM_YPS()
            Case MoldSeries.ATOM_FZ
                SetToolFx_Fz_G_YPC_YPM_YPS()
            Case MoldSeries.G_LINE
                SetToolFx_Fz_G_YPC_YPM_YPS()
            Case MoldSeries.Y_PC
                SetToolFx_Fz_G_YPC_YPM_YPS()
            Case MoldSeries.YPM
                SetToolFx_Fz_G_YPC_YPM_YPS()
            Case MoldSeries.YPS
                SetToolFx_Fz_G_YPC_YPM_YPS()
            Case MoldSeries.PMC
                SetToolPMC()
            Case MoldSeries.YPM_MAP
                SetToolMAP()
            Case MoldSeries.YPS_MAP
                SetToolMAP()
            Case MoldSeries.YPS_MAP2
                SetToolMAP2()
        End Select

        btnSaveTool = New Button
        btnSaveTool.Text = "保存"
        btnSaveTool.Location = New Drawing.Point(861, 491)
        btnSaveTool.Size = New Drawing.Size(107, 31)
        tabTool.Controls.Add(btnSaveTool)
        AddHandler btnSaveTool.Click, AddressOf ButtonToolSave_Click
    End Sub

    Private iToolLeft As Integer

    Private TitleTool() As Label
    Private lblToolRowNo() As Label
    Private lblToolTopBottom() As Label
    Private btnToolPkg() As Button
    Private bccToolPkg() As BarCodeCell
    Private tklToolPkg() As TenKeyLabel
    Private ltlToolCav() As LiteralLabel
    Private ltlToolNo() As LiteralLabel
    Private sllToolTemp() As SmallLiteralLabel
    Private sllToolStopWatch() As SmallLiteralLabel

    Private Sub SetToolAtom100pf_500f()
        SetTitleTool1()

        ReDim btnToolPkg(0)
        ReDim bccToolPkg(0)
        ReDim ltlToolCav(0)
        ReDim ltlToolNo(0)
        ReDim sllToolTemp(0)
        ReDim sllToolStopWatch(0)

        btnToolPkg(0) = New Button
        btnToolPkg(0).Text = "PKG名"
        btnToolPkg(0).Top = TAB_TOP + CELL_HEIGNT - 1
        btnToolPkg(0).Left = iToolLeft
        btnToolPkg(0).Width = CELL_WIDTH0 + 2
        btnToolPkg(0).Height = CELL_HEIGNT
        btnToolPkg(0).Tag = 0
        AddHandler btnToolPkg(0).Click, AddressOf ButtonToolPkg_Click

        bccToolPkg(0) = New BarCodeCell
        bccToolPkg(0).Text = ""
        bccToolPkg(0).Top = TAB_TOP + CELL_HEIGNT - 1
        bccToolPkg(0).Left = btnToolPkg(0).Right
        bccToolPkg(0).Width = CELL_WIDTH1
        bccToolPkg(0).Height = CELL_HEIGNT
        'AddHandler bccToolPkg(0).InputComleted, AddressOf BarCodeCell_InputCompleted

        ltlToolCav(0) = New LiteralLabel
        ltlToolCav(0).Literal = "CAV"
        ltlToolCav(0).Top = TAB_TOP + CELL_HEIGNT - 1
        ltlToolCav(0).Left = bccToolPkg(0).Right - 1
        ltlToolCav(0).Width = CELL_WIDTH1
        ltlToolCav(0).Height = CELL_HEIGNT
        AddHandler ltlToolCav(0).Click, AddressOf LiteralLabel_Click

        ltlToolNo(0) = New LiteralLabel
        ltlToolNo(0).Literal = "号型"
        ltlToolNo(0).Top = TAB_TOP + CELL_HEIGNT - 1
        ltlToolNo(0).Left = ltlToolCav(0).Right - 1
        ltlToolNo(0).Width = CELL_WIDTH1
        ltlToolNo(0).Height = CELL_HEIGNT
        AddHandler ltlToolNo(0).Click, AddressOf LiteralLabel_Click

        sllToolTemp(0) = New SmallLiteralLabel
        sllToolTemp(0).Literal = "H"
        sllToolTemp(0).Top = TAB_TOP + CELL_HEIGNT - 1
        sllToolTemp(0).Left = ltlToolNo(0).Right - 1
        sllToolTemp(0).Width = CELL_WIDTH0
        sllToolTemp(0).Height = CELL_HEIGNT
        AddHandler sllToolTemp(0).Click, AddressOf SmallLiteralLabel_Click

        sllToolStopWatch(0) = New SmallLiteralLabel
        sllToolStopWatch(0).Literal = "S"
        sllToolStopWatch(0).Top = TAB_TOP + CELL_HEIGNT - 1
        sllToolStopWatch(0).Left = sllToolTemp(0).Right - 1
        sllToolStopWatch(0).Width = CELL_WIDTH0
        sllToolStopWatch(0).Height = CELL_HEIGNT
        AddHandler sllToolStopWatch(0).Click, AddressOf SmallLiteralLabel_Click

        tabTool.Controls.AddRange(btnToolPkg)
        tabTool.Controls.AddRange(bccToolPkg)
        tabTool.Controls.AddRange(ltlToolCav)
        tabTool.Controls.AddRange(ltlToolNo)
        tabTool.Controls.AddRange(sllToolTemp)
        tabTool.Controls.AddRange(sllToolStopWatch)
    End Sub

    Private Const TOOL_Fx_Fz_G_YPC_YPM_YPS_ROW = 4
    Private Sub SetToolFx_Fz_G_YPC_YPM_YPS()
        SetTitleTool2()

        ReDim lblToolRowNo(TOOL_Fx_Fz_G_YPC_YPM_YPS_ROW)
        ReDim btnToolPkg(TOOL_Fx_Fz_G_YPC_YPM_YPS_ROW)
        ReDim bccToolPkg(TOOL_Fx_Fz_G_YPC_YPM_YPS_ROW)
        ReDim ltlToolCav(TOOL_Fx_Fz_G_YPC_YPM_YPS_ROW)
        ReDim ltlToolNo(TOOL_Fx_Fz_G_YPC_YPM_YPS_ROW)
        ReDim sllToolTemp(TOOL_Fx_Fz_G_YPC_YPM_YPS_ROW)
        ReDim sllToolStopWatch(TOOL_Fx_Fz_G_YPC_YPM_YPS_ROW)

        Dim i As Integer

        For i = 0 To TOOL_Fx_Fz_G_YPC_YPM_YPS_ROW - 1
            btnToolPkg(i) = New Button
            btnToolPkg(i).Text = "PKG名"
            btnToolPkg(i).Top = TAB_TOP + CELL_HEIGNT + CELL_HEIGNT * i - i - 1
            btnToolPkg(i).Left = iToolLeft
            btnToolPkg(i).Width = CELL_WIDTH0 + 2
            btnToolPkg(i).Height = CELL_HEIGNT
            btnToolPkg(i).Tag = i
            AddHandler btnToolPkg(i).Click, AddressOf ButtonToolPkg_Click

            bccToolPkg(i) = New BarCodeCell
            bccToolPkg(i).Text = ""
            bccToolPkg(i).Top = TAB_TOP + CELL_HEIGNT + CELL_HEIGNT * i - i - 1
            bccToolPkg(i).Left = btnToolPkg(0).Right
            bccToolPkg(i).Width = CELL_WIDTH1
            bccToolPkg(i).Height = CELL_HEIGNT
            'AddHandler bccToolPkg(i).InputComleted, AddressOf BarCodeCell_InputCompleted

            lblToolRowNo(i) = New Label
            lblToolRowNo(i).Text = (i + 1).ToString
            lblToolRowNo(i).Top = TAB_TOP + CELL_HEIGNT + CELL_HEIGNT * i - i - 1
            lblToolRowNo(i).Left = bccToolPkg(0).Right - 1
            lblToolRowNo(i).Width = CELL_WIDTH_HALF
            lblToolRowNo(i).Height = CELL_HEIGNT
            lblToolRowNo(i).BackColor = CELL_COLOR_NORMAL
            lblToolRowNo(i).BorderStyle = BorderStyle.FixedSingle
            lblToolRowNo(i).TextAlign = ContentAlignment.MiddleCenter

            ltlToolCav(i) = New LiteralLabel
            ltlToolCav(i).Literal = "CAV"
            ltlToolCav(i).Top = TAB_TOP + CELL_HEIGNT + CELL_HEIGNT * i - i - 1
            ltlToolCav(i).Left = lblToolRowNo(0).Right - 1
            ltlToolCav(i).Width = CELL_WIDTH1
            ltlToolCav(i).Height = CELL_HEIGNT
            AddHandler ltlToolCav(i).Click, AddressOf LiteralLabel_Click

            ltlToolNo(i) = New LiteralLabel
            ltlToolNo(i).Literal = "号型"
            ltlToolNo(i).Top = TAB_TOP + CELL_HEIGNT + CELL_HEIGNT * i - i - 1
            ltlToolNo(i).Left = ltlToolCav(0).Right - 1
            ltlToolNo(i).Width = CELL_WIDTH1
            ltlToolNo(i).Height = CELL_HEIGNT
            AddHandler ltlToolNo(i).Click, AddressOf LiteralLabel_Click

            sllToolTemp(i) = New SmallLiteralLabel
            sllToolTemp(i).Literal = "H"
            sllToolTemp(i).Top = TAB_TOP + CELL_HEIGNT + CELL_HEIGNT * i - i - 1
            sllToolTemp(i).Left = ltlToolNo(0).Right - 1
            sllToolTemp(i).Width = CELL_WIDTH0
            sllToolTemp(i).Height = CELL_HEIGNT
            AddHandler sllToolTemp(i).Click, AddressOf SmallLiteralLabel_Click

            sllToolStopWatch(i) = New SmallLiteralLabel
            sllToolStopWatch(i).Literal = "S"
            sllToolStopWatch(i).Top = TAB_TOP + CELL_HEIGNT + CELL_HEIGNT * i - i - 1
            sllToolStopWatch(i).Left = sllToolTemp(0).Right - 1
            sllToolStopWatch(i).Width = CELL_WIDTH0
            sllToolStopWatch(i).Height = CELL_HEIGNT
            AddHandler sllToolStopWatch(i).Click, AddressOf SmallLiteralLabel_Click
        Next

        tabTool.Controls.AddRange(btnToolPkg)
        tabTool.Controls.AddRange(bccToolPkg)
        tabTool.Controls.AddRange(lblToolRowNo)
        tabTool.Controls.AddRange(ltlToolCav)
        tabTool.Controls.AddRange(ltlToolNo)
        tabTool.Controls.AddRange(sllToolTemp)
        tabTool.Controls.AddRange(sllToolStopWatch)
    End Sub

    Private Const TOOL_PMC_ROW = 4
    Private Sub SetToolPMC()
        SetTitleTool3()

        ReDim lblToolRowNo(TOOL_PMC_ROW / 2)
        ReDim lblToolTopBottom(TOOL_PMC_ROW)
        ReDim ltlToolNo(TOOL_PMC_ROW)
        ReDim sllToolTemp(TOOL_PMC_ROW / 2)

        Dim i As Integer

        For i = 0 To TOOL_PMC_ROW - 1

            If i < TOOL_PMC_ROW / 2 Then
                lblToolRowNo(i) = New Label
                lblToolRowNo(i).Text = (i + 1).ToString
                lblToolRowNo(i).Top = TAB_TOP + CELL_HEIGNT + CELL_HEIGNT * i * 2 - i * 2 - 1
                lblToolRowNo(i).Left = iToolLeft
                lblToolRowNo(i).Width = CELL_WIDTH_HALF
                lblToolRowNo(i).Height = CELL_HEIGNT * 2 - 1
                lblToolRowNo(i).BackColor = CELL_COLOR_NORMAL
                lblToolRowNo(i).BorderStyle = BorderStyle.FixedSingle
                lblToolRowNo(i).TextAlign = ContentAlignment.MiddleCenter
            End If

            lblToolTopBottom(i) = New Label
            If i Mod 2 = 0 Then
                lblToolTopBottom(i).Text = "上型"
            Else
                lblToolTopBottom(i).Text = "下型"
            End If
            lblToolTopBottom(i).Top = TAB_TOP + CELL_HEIGNT + CELL_HEIGNT * i - i - 1
            lblToolTopBottom(i).Left = lblToolRowNo(0).Right - 1
            lblToolTopBottom(i).Width = CELL_WIDTH0
            lblToolTopBottom(i).Height = CELL_HEIGNT
            lblToolTopBottom(i).BackColor = CELL_COLOR_NORMAL
            lblToolTopBottom(i).BorderStyle = BorderStyle.FixedSingle
            lblToolTopBottom(i).TextAlign = ContentAlignment.MiddleCenter

            ltlToolNo(i) = New LiteralLabel
            ltlToolNo(i).Literal = "号型"
            ltlToolNo(i).Top = TAB_TOP + CELL_HEIGNT + CELL_HEIGNT * i - i - 1
            ltlToolNo(i).Left = lblToolTopBottom(0).Right - 1
            ltlToolNo(i).Width = CELL_WIDTH1
            ltlToolNo(i).Height = CELL_HEIGNT
            AddHandler ltlToolNo(i).Click, AddressOf LiteralLabel_Click

            If i < TOOL_PMC_ROW / 2 Then
                sllToolTemp(i) = New SmallLiteralLabel
                sllToolTemp(i).Literal = "H"
                sllToolTemp(i).Top = TAB_TOP + CELL_HEIGNT + CELL_HEIGNT * i * 2 - i * 2 - 1
                sllToolTemp(i).Left = ltlToolNo(0).Right - 1
                sllToolTemp(i).Width = CELL_WIDTH0
                sllToolTemp(i).Height = CELL_HEIGNT * 2 - 1
                AddHandler sllToolTemp(i).Click, AddressOf SmallLiteralLabel_Click
            End If
        Next

        tabTool.Controls.AddRange(lblToolRowNo)
        tabTool.Controls.AddRange(lblToolTopBottom)
        tabTool.Controls.AddRange(ltlToolNo)
        tabTool.Controls.AddRange(sllToolTemp)
    End Sub

    Private Const TOOL_MAP_ROW = 2
    Private Sub SetToolMAP()
        SetTitleTool4_5()

        ReDim lblToolRowNo(TOOL_MAP_ROW)
        ReDim tklToolPkg(TOOL_MAP_ROW)
        ReDim ltlToolNo(TOOL_MAP_ROW)
        ReDim sllToolTemp(TOOL_MAP_ROW)

        Dim i As Integer

        For i = 0 To TOOL_MAP_ROW - 1

            lblToolRowNo(i) = New Label
            lblToolRowNo(i).Text = (i + 1).ToString
            lblToolRowNo(i).Top = TAB_TOP + CELL_HEIGNT + CELL_HEIGNT * i - i - 1
            lblToolRowNo(i).Left = iToolLeft
            lblToolRowNo(i).Width = CELL_WIDTH_HALF
            lblToolRowNo(i).Height = CELL_HEIGNT
            lblToolRowNo(i).BackColor = CELL_COLOR_NORMAL
            lblToolRowNo(i).BorderStyle = BorderStyle.FixedSingle
            lblToolRowNo(i).TextAlign = ContentAlignment.MiddleCenter

            tklToolPkg(i) = New TenKeyLabel
            tklToolPkg(i).Top = TAB_TOP + CELL_HEIGNT + CELL_HEIGNT * i - i - 1
            tklToolPkg(i).Left = lblToolRowNo(0).Right - 1
            tklToolPkg(i).Width = CELL_WIDTH1
            tklToolPkg(i).Height = CELL_HEIGNT
            tklToolPkg(i).TextAlign = ContentAlignment.MiddleCenter
            AddHandler tklToolPkg(i).Click, AddressOf tklToolPkg_Click

            ltlToolNo(i) = New LiteralLabel
            ltlToolNo(i).Literal = "号型"
            ltlToolNo(i).Top = TAB_TOP + CELL_HEIGNT + CELL_HEIGNT * i - i - 1
            ltlToolNo(i).Left = tklToolPkg(0).Right - 1
            ltlToolNo(i).Width = CELL_WIDTH1
            ltlToolNo(i).Height = CELL_HEIGNT
            AddHandler ltlToolNo(i).Click, AddressOf LiteralLabel_Click

            sllToolTemp(i) = New SmallLiteralLabel
            sllToolTemp(i).Literal = "H"
            sllToolTemp(i).Top = TAB_TOP + CELL_HEIGNT + CELL_HEIGNT * i - i - 1
            sllToolTemp(i).Left = ltlToolNo(0).Right - 1
            sllToolTemp(i).Width = CELL_WIDTH0
            sllToolTemp(i).Height = CELL_HEIGNT
            AddHandler sllToolTemp(i).Click, AddressOf SmallLiteralLabel_Click
        Next

        tabTool.Controls.AddRange(lblToolRowNo)
        tabTool.Controls.AddRange(tklToolPkg)
        tabTool.Controls.AddRange(ltlToolNo)
        tabTool.Controls.AddRange(sllToolTemp)
    End Sub

    Private Const TOOL_MAP2_ROW = 3
    Private Sub SetToolMAP2()
        SetTitleTool4_5()

        ReDim lblToolRowNo(TOOL_MAP2_ROW)
        ReDim tklToolPkg(TOOL_MAP2_ROW)
        ReDim ltlToolNo(TOOL_MAP2_ROW)
        ReDim sllToolTemp(TOOL_MAP2_ROW)

        Dim i As Integer

        For i = 0 To TOOL_MAP2_ROW - 1

            lblToolRowNo(i) = New Label
            lblToolRowNo(i).Text = (i + 1).ToString
            lblToolRowNo(i).Top = TAB_TOP + CELL_HEIGNT + CELL_HEIGNT * i - i - 1
            lblToolRowNo(i).Left = iToolLeft
            lblToolRowNo(i).Width = CELL_WIDTH_HALF
            lblToolRowNo(i).Height = CELL_HEIGNT
            lblToolRowNo(i).BackColor = CELL_COLOR_NORMAL
            lblToolRowNo(i).BorderStyle = BorderStyle.FixedSingle
            lblToolRowNo(i).TextAlign = ContentAlignment.MiddleCenter

            tklToolPkg(i) = New TenKeyLabel
            tklToolPkg(i).Top = TAB_TOP + CELL_HEIGNT + CELL_HEIGNT * i - i - 1
            tklToolPkg(i).Left = lblToolRowNo(0).Right - 1
            tklToolPkg(i).Width = CELL_WIDTH1
            tklToolPkg(i).Height = CELL_HEIGNT
            tklToolPkg(i).TextAlign = ContentAlignment.MiddleCenter
            AddHandler tklToolPkg(i).Click, AddressOf tklToolPkg_Click

            ltlToolNo(i) = New LiteralLabel
            ltlToolNo(i).Literal = "号型"
            ltlToolNo(i).Top = TAB_TOP + CELL_HEIGNT + CELL_HEIGNT * i - i - 1
            ltlToolNo(i).Left = tklToolPkg(0).Right - 1
            ltlToolNo(i).Width = CELL_WIDTH1
            ltlToolNo(i).Height = CELL_HEIGNT
            AddHandler ltlToolNo(i).Click, AddressOf LiteralLabel_Click

            sllToolTemp(i) = New SmallLiteralLabel
            sllToolTemp(i).Literal = "H"
            sllToolTemp(i).Top = TAB_TOP + CELL_HEIGNT + CELL_HEIGNT * i - i - 1
            sllToolTemp(i).Left = ltlToolNo(0).Right - 1
            sllToolTemp(i).Width = CELL_WIDTH0
            sllToolTemp(i).Height = CELL_HEIGNT
            AddHandler sllToolTemp(i).Click, AddressOf SmallLiteralLabel_Click
        Next

        tabTool.Controls.AddRange(lblToolRowNo)
        tabTool.Controls.AddRange(tklToolPkg)
        tabTool.Controls.AddRange(ltlToolNo)
        tabTool.Controls.AddRange(sllToolTemp)
    End Sub

    Private Sub SetTitleTool1()
        ReDim TitleTool(3)
        Dim i As Integer
        For i = 0 To TitleTool.Length - 1
            TitleTool(i) = New Label
            'TitleTool(i).Font = New Font("", 16)
            TitleTool(i).Top = TAB_TOP
            TitleTool(i).Height = CELL_HEIGNT
            TitleTool(i).BorderStyle = BorderStyle.FixedSingle
            TitleTool(i).TextAlign = ContentAlignment.MiddleCenter
            TitleTool(i).BackColor = CELL_COLOR_TITLE
        Next

        iToolLeft = (tabTool.Width - (CELL_WIDTH0 + CELL_WIDTH1 + CELL_WIDTH1 + CELL_WIDTH1 + CELL_WIDTH0 + CELL_WIDTH0 - 2)) / 2

        TitleTool(0).Text = "CAV数"
        TitleTool(0).Left = iToolLeft + CELL_WIDTH0 + CELL_WIDTH1 + 1
        TitleTool(0).Width = CELL_WIDTH1
        TitleTool(1).Text = "金型No."
        TitleTool(1).Left = TitleTool(0).Right - 1
        TitleTool(1).Width = CELL_WIDTH1
        TitleTool(2).Text = "温度計"
        TitleTool(2).Left = TitleTool(1).Right - 1
        TitleTool(2).Width = CELL_WIDTH0
        TitleTool(3).Text = "ストップ" & vbCrLf & "ウォッチ"
        TitleTool(3).Left = TitleTool(2).Right - 1
        TitleTool(3).Width = CELL_WIDTH0
        TitleTool(3).Font = New Font("", 12)

        tabTool.Controls.AddRange(TitleTool)

    End Sub

    Private Sub SetTitleTool2()
        ReDim TitleTool(3)
        Dim i As Integer
        For i = 0 To TitleTool.Length - 1
            TitleTool(i) = New Label
            'TitleTool(i).Font = New Font("", 16)
            TitleTool(i).Top = TAB_TOP
            TitleTool(i).Height = CELL_HEIGNT
            TitleTool(i).BorderStyle = BorderStyle.FixedSingle
            TitleTool(i).TextAlign = ContentAlignment.MiddleCenter
            TitleTool(i).BackColor = CELL_COLOR_TITLE
        Next

        iToolLeft = (tabTool.Width - (CELL_WIDTH0 + CELL_WIDTH1 + CELL_WIDTH_HALF + CELL_WIDTH1 + CELL_WIDTH1 + CELL_WIDTH0 + CELL_WIDTH0 - 3)) / 2

        TitleTool(0).Text = "CAV数"
        TitleTool(0).Left = iToolLeft + CELL_WIDTH0 + CELL_WIDTH1 + CELL_WIDTH_HALF
        TitleTool(0).Width = CELL_WIDTH1
        TitleTool(1).Text = "金型No."
        TitleTool(1).Left = TitleTool(0).Right - 1
        TitleTool(1).Width = CELL_WIDTH1
        TitleTool(2).Text = "温度計"
        TitleTool(2).Left = TitleTool(1).Right - 1
        TitleTool(2).Width = CELL_WIDTH0
        TitleTool(3).Text = "ストップ" & vbCrLf & "ウォッチ"
        TitleTool(3).Left = TitleTool(2).Right - 1
        TitleTool(3).Width = CELL_WIDTH0
        TitleTool(3).Font = New Font("", 12)

        tabTool.Controls.AddRange(TitleTool)

    End Sub

    Private Sub SetTitleTool3()
        ReDim TitleTool(1)
        Dim i As Integer
        For i = 0 To TitleTool.Length - 1
            TitleTool(i) = New Label
            'TitleTool(i).Font = New Font("", 16)
            TitleTool(i).Top = TAB_TOP
            TitleTool(i).Height = CELL_HEIGNT
            TitleTool(i).BorderStyle = BorderStyle.FixedSingle
            TitleTool(i).TextAlign = ContentAlignment.MiddleCenter
            TitleTool(i).BackColor = CELL_COLOR_TITLE
        Next

        iToolLeft = (tabTool.Width - (CELL_WIDTH_HALF + CELL_WIDTH0 + CELL_WIDTH1 + CELL_WIDTH0 - 3)) / 2

        TitleTool(0).Text = "金型No."
        TitleTool(0).Left = iToolLeft + CELL_WIDTH_HALF + CELL_WIDTH0 - 2
        TitleTool(0).Width = CELL_WIDTH1
        TitleTool(1).Text = "温度計"
        TitleTool(1).Left = TitleTool(0).Right - 1
        TitleTool(1).Width = CELL_WIDTH0

        tabTool.Controls.AddRange(TitleTool)
    End Sub

    Private Sub SetTitleTool4_5()
        ReDim TitleTool(2)
        Dim i As Integer
        For i = 0 To TitleTool.Length - 1
            TitleTool(i) = New Label
            'TitleTool(i).Font = New Font("", 16)
            TitleTool(i).Top = TAB_TOP
            TitleTool(i).Height = CELL_HEIGNT
            TitleTool(i).BorderStyle = BorderStyle.FixedSingle
            TitleTool(i).TextAlign = ContentAlignment.MiddleCenter
            TitleTool(i).BackColor = CELL_COLOR_TITLE
        Next

        iToolLeft = (tabTool.Width - (CELL_WIDTH_HALF + CELL_WIDTH1 + CELL_WIDTH1 + CELL_WIDTH0 - 3)) / 2

        TitleTool(0).Text = "PKGタイプ"
        TitleTool(0).Left = iToolLeft + CELL_WIDTH_HALF - 1
        TitleTool(0).Width = CELL_WIDTH1
        TitleTool(1).Text = "金型No."
        TitleTool(1).Left = TitleTool(0).Right - 1
        TitleTool(1).Width = CELL_WIDTH1
        TitleTool(2).Text = "温度計"
        TitleTool(2).Left = TitleTool(1).Right - 1
        TitleTool(2).Width = CELL_WIDTH0

        tabTool.Controls.AddRange(TitleTool)

    End Sub

#End Region

#Region "動作"
    Private Sub ButtonToolPkg_Click(ByVal sender As Object, ByVal e As EventArgs)
        Dim btnPkg As Button = CType(sender, Button)
        Dim bccPkg As BarCodeCell = bccToolPkg(CInt(btnPkg.Tag))
        bccPkg.BeginInput()
    End Sub

    'Private Sub ltlToolCav_Click(ByVal sender As Object, ByVal e As EventArgs)
    '    Dim ltl As LiteralLabel = CType(sender, LiteralLabel)
    '    CallTenkey(ltl.InputLabel)
    'End Sub

    'Private Sub ltlToolNo_Click(ByVal sender As Object, ByVal e As EventArgs)
    '    Dim ltl As LiteralLabel = CType(sender, LiteralLabel)
    '    CallTenkey(ltl.InputLabel)
    'End Sub

    Private Sub tklToolPkg_Click(ByVal sender As Object, ByVal e As EventArgs)
        Dim tkl As TenKeyLabel = CType(sender, TenKeyLabel)

        Dim frmPkg As New frmPkgType(tkl)
        frmPkg.StartPosition = FormStartPosition.CenterParent
        frmPkg.ShowDialog()
    End Sub

    Private Sub ButtonToolSave_Click(ByVal sender As Object, ByVal e As EventArgs)
        MsgBox(bccToolPkg(0).Text)
    End Sub

    'Private Sub BarCodeCell_InputCompleted(ByVal sender As Object)
    '    Dim bcc As BarCodeCell = CType(sender, BarCodeCell)
    '    MsgBox(bcc.Text)
    'End Sub
#End Region

#Region "初期化"
    Private Sub InitTabTool()
        SetTabTool()
    End Sub
#End Region

#Region "保存"

    Const szTagToolPkg = "ToolPkg{0}"
    Const szTagToolCav = "ToolCav{0}"
    Const szTagToolNo = "ToolNo{0}"
    Const szTagToolNoAbove = "ToolNo{0}Above"
    Const szTagToolNoBelow = "ToolNo{0}Below"
    Const szTagToolTmp = "ToolTmp{0}"
    Const szTagToolStop = "ToolStop{0}"

    Private Sub btnToolSave_Click(ByVal sender As Object, ByVal e As System.EventArgs)
        Dim lstData As New List(Of String())
        lstData.Add({bccEquipID.Text, "ICTAG_LOT", bccEquipID.Text, szTagSeries, m_MoldSeries.ToString})
        lstData.Add({bccEquipID.Text, "ICTAG_LOT", bccEquipID.Text, szTagEquipID, bccEquipID.Text})
        lstData.Add({bccEquipID.Text, "ICTAG_LOT", bccEquipID.Text, szTagProcs, tabTool.Text})
        lstData.Add({bccEquipID.Text, "ICTAG_LOT", bccEquipID.Text, szTagLotNo, "ICTAG_LOT"})
        lstData.Add({bccEquipID.Text, "ICTAG_LOT", bccEquipID.Text, szTagBeginTM, ""})
        Select Case m_MoldSeries
            Case MoldSeries.ATOM_100PF
                SaveToolData1(lstData)
            Case MoldSeries.ATOM_500F
                SaveToolData1(lstData)
            Case MoldSeries.ATOM_FX_FS
                SaveToolData2(lstData)
            Case MoldSeries.ATOM_FZ
                SaveToolData2(lstData)
            Case MoldSeries.G_LINE
                SaveToolData2(lstData)
            Case MoldSeries.Y_PC
                SaveToolData2(lstData)
            Case MoldSeries.YPM
                SaveToolData2(lstData)
            Case MoldSeries.YPS
                SaveToolData2(lstData)
            Case MoldSeries.PMC
                SaveToolData3(lstData)
            Case MoldSeries.YPM_MAP
                SaveToolData4(lstData)
            Case MoldSeries.YPS_MAP
                SaveToolData4(lstData)
            Case MoldSeries.YPS_MAP2
                SaveToolData5(lstData)
        End Select

        m_cTenken.SaveSwapMold(lstData, bccEquipID.Text, "ICTAG_LOT", "")
    End Sub

    Private Sub SaveToolData1(ByRef lstData As List(Of String()))
        lstData.Add({bccEquipID.Text, "ICTAG_LOT", String.Format(szTagToolPkg, 1), bccToolPkg(0).Text})
        lstData.Add({bccEquipID.Text, "ICTAG_LOT", String.Format(szTagToolCav, 1), ltlToolCav(0).Text})
        lstData.Add({bccEquipID.Text, "ICTAG_LOT", String.Format(szTagToolNo, 1), ltlToolNo(0).Text})
        lstData.Add({bccEquipID.Text, "ICTAG_LOT", String.Format(szTagToolTmp, 1), sllToolTemp(0).Text})
        lstData.Add({bccEquipID.Text, "ICTAG_LOT", String.Format(szTagToolStop, 1), sllToolStopWatch(0).Text})
    End Sub

    Private Sub SaveToolData2(ByRef lstData As List(Of String()))
        Dim i As Integer
        For i = 0 To 3
            lstData.Add({bccEquipID.Text, "ICTAG_LOT", String.Format(szTagToolPkg, i + 1), bccToolPkg(i).Text})
            lstData.Add({bccEquipID.Text, "ICTAG_LOT", String.Format(szTagToolCav, i + 1), ltlToolCav(i).Text})
            lstData.Add({bccEquipID.Text, "ICTAG_LOT", String.Format(szTagToolNo, i + 1), ltlToolNo(i).Text})
            lstData.Add({bccEquipID.Text, "ICTAG_LOT", String.Format(szTagToolTmp, i + 1), sllToolTemp(i).Text})
            lstData.Add({bccEquipID.Text, "ICTAG_LOT", String.Format(szTagToolStop, i + 1), sllToolStopWatch(i).Text})
        Next
    End Sub

    Private Sub SaveToolData3(ByRef lstData As List(Of String()))
        Dim i As Integer
        For i = 0 To 1
            lstData.Add({bccEquipID.Text, "ICTAG_LOT", String.Format(szTagToolNoAbove, i + 1), bccToolPkg(i).Text})
            lstData.Add({bccEquipID.Text, "ICTAG_LOT", String.Format(szTagToolNoBelow, i + 1), ltlToolCav(i).Text})
            lstData.Add({bccEquipID.Text, "ICTAG_LOT", String.Format(szTagToolTmp, i + 1), sllToolTemp(i).Text})
        Next
    End Sub

    Private Sub SaveToolData4(ByRef lstData As List(Of String()))
        Dim i As Integer
        For i = 0 To 1
            lstData.Add({bccEquipID.Text, "ICTAG_LOT", String.Format(szTagToolPkg, i + 1), tklToolPkg(i).Text})
            lstData.Add({bccEquipID.Text, "ICTAG_LOT", String.Format(szTagToolNo, i + 1), ltlToolNo(i).Text})
            lstData.Add({bccEquipID.Text, "ICTAG_LOT", String.Format(szTagToolTmp, i + 1), sllToolTemp(i).Text})
        Next
    End Sub

    Private Sub SaveToolData5(ByRef lstData As List(Of String()))
        Dim i As Integer
        For i = 0 To 2
            lstData.Add({bccEquipID.Text, "ICTAG_LOT", String.Format(szTagToolPkg, i + 1), tklToolPkg(i).Text})
            lstData.Add({bccEquipID.Text, "ICTAG_LOT", String.Format(szTagToolNo, i + 1), ltlToolNo(i).Text})
            lstData.Add({bccEquipID.Text, "ICTAG_LOT", String.Format(szTagToolTmp, i + 1), sllToolTemp(i).Text})
        Next
    End Sub
#End Region

#End Region

#Region "作業条件"

    Protected btnSaveCond As New Button

#Region "表示内容"
    Private Sub SetTabCond()
        tabCond.Controls.Clear()
        Select Case m_MoldSeries
            Case MoldSeries.ATOM_100PF
                SetCondAtom100pf()
            Case MoldSeries.ATOM_500F
                SetCondAtom500f()
            Case MoldSeries.ATOM_FX_FS
                SetCondFx_Fz_G_YPC_YPM_YPS()
            Case MoldSeries.ATOM_FZ
                SetCondFx_Fz_G_YPC_YPM_YPS()
            Case MoldSeries.G_LINE
                SetCondFx_Fz_G_YPC_YPM_YPS()
            Case MoldSeries.Y_PC
                SetCondFx_Fz_G_YPC_YPM_YPS()
            Case MoldSeries.YPM
                SetCondFx_Fz_G_YPC_YPM_YPS()
            Case MoldSeries.YPS
                SetCondFx_Fz_G_YPC_YPM_YPS()
            Case MoldSeries.PMC
                SetcondPMC()
            Case MoldSeries.YPM_MAP
                SetCondMAP()
            Case MoldSeries.YPS_MAP
                SetCondMAP()
            Case MoldSeries.YPS_MAP2
                SetCondMAP2()
        End Select

        btnSaveCond.Text = "保存"
        btnSaveCond.Location = New Drawing.Point(861, 491)
        btnSaveCond.Size = New Drawing.Size(107, 31)
        tabCond.Controls.Add(btnSaveCond)
        'AddHandler btnSaveCond.Click, AddressOf ButtonCondSave_Click
    End Sub

    Dim iCondLeft As Integer

    Private TitleCond() As Label
    Private lblCondItem As Label
    Private lblCondRowNo() As Label
    Private ltlCondClamp() As LiteralLabel
    Private ltlCondPlunger() As LiteralLabel
    Private ltlCondDecompress() As LiteralLabel
    Private ltlCondFmTime() As LiteralLabel
    Private ltlCondMovTime() As LiteralLabel
    Private ltlCondMoldTime() As LiteralLabel
    Private ltlCondTemp() As LiteralLabel

    Private Sub SetCondAtom100pf()
        SetTitleCond1_2()

        ReDim ltlCondClamp(0)
        ReDim ltlCondPlunger(0)
        ReDim ltlCondDecompress(0)
        ReDim ltlCondMovTime(0)
        ReDim ltlCondMoldTime(0)

        lblCondItem = New Label
        lblCondItem.Text = "実測値"
        lblCondItem.Top = TAB_TOP + CELL_HEIGNT - 1
        lblCondItem.Left = iCondLeft
        lblCondItem.Width = CELL_WIDTH0
        lblCondItem.Height = CELL_HEIGNT
        lblCondItem.BackColor = CELL_COLOR_NORMAL
        lblCondItem.BorderStyle = BorderStyle.FixedSingle
        lblCondItem.TextAlign = ContentAlignment.MiddleCenter

        ltlCondClamp(0) = New LiteralLabel
        ltlCondClamp(0).Literal = "(km/cm²)"
        ltlCondClamp(0).Top = TAB_TOP + CELL_HEIGNT - 1
        ltlCondClamp(0).Left = lblCondItem.Right - 1
        ltlCondClamp(0).Width = CELL_WIDTH1
        ltlCondClamp(0).Height = CELL_HEIGNT
        ltlCondClamp(0).LiteralSize = 10
        AddHandler ltlCondClamp(0).Click, AddressOf LiteralLabel_Click

        ltlCondPlunger(0) = New LiteralLabel
        ltlCondPlunger(0).Literal = "(km/cm²)"
        ltlCondPlunger(0).Top = TAB_TOP + CELL_HEIGNT - 1
        ltlCondPlunger(0).Left = ltlCondClamp(0).Right - 1
        ltlCondPlunger(0).Width = CELL_WIDTH1
        ltlCondPlunger(0).Height = CELL_HEIGNT
        ltlCondPlunger(0).LiteralSize = 10
        AddHandler ltlCondPlunger(0).Click, AddressOf LiteralLabel_Click

        ltlCondDecompress(0) = New LiteralLabel
        ltlCondDecompress(0).Literal = "(mmHg)"
        ltlCondDecompress(0).Top = TAB_TOP + CELL_HEIGNT - 1
        ltlCondDecompress(0).Left = ltlCondPlunger(0).Right - 1
        ltlCondDecompress(0).Width = CELL_WIDTH1
        ltlCondDecompress(0).Height = CELL_HEIGNT
        ltlCondDecompress(0).LiteralSize = 10
        AddHandler ltlCondDecompress(0).Click, AddressOf LiteralLabel_Click

        ltlCondMovTime(0) = New LiteralLabel
        ltlCondMovTime(0).Literal = "(sec)"
        ltlCondMovTime(0).Top = TAB_TOP + CELL_HEIGNT - 1
        ltlCondMovTime(0).Left = ltlCondDecompress(0).Right - 1
        ltlCondMovTime(0).Width = CELL_WIDTH1
        ltlCondMovTime(0).Height = CELL_HEIGNT
        ltlCondMovTime(0).LiteralSize = 10
        AddHandler ltlCondMovTime(0).Click, AddressOf LiteralLabel_Click

        ltlCondMoldTime(0) = New LiteralLabel
        ltlCondMoldTime(0).Literal = "(sec)"
        ltlCondMoldTime(0).Top = TAB_TOP + CELL_HEIGNT - 1
        ltlCondMoldTime(0).Left = ltlCondMovTime(0).Right - 1
        ltlCondMoldTime(0).Width = CELL_WIDTH1
        ltlCondMoldTime(0).Height = CELL_HEIGNT
        ltlCondMoldTime(0).LiteralSize = 10
        AddHandler ltlCondMoldTime(0).Click, AddressOf LiteralLabel_Click

        tabCond.Controls.Add(lblCondItem)
        tabCond.Controls.AddRange(ltlCondClamp)
        tabCond.Controls.AddRange(ltlCondPlunger)
        tabCond.Controls.AddRange(ltlCondDecompress)
        tabCond.Controls.AddRange(ltlCondMovTime)
        tabCond.Controls.AddRange(ltlCondMoldTime)
    End Sub

    Private Sub SetCondAtom500f()
        SetTitleCond1_2()

        ReDim ltlCondClamp(0)
        ReDim ltlCondPlunger(0)
        ReDim ltlCondDecompress(0)
        ReDim ltlCondMovTime(0)
        ReDim ltlCondMoldTime(0)

        lblCondItem = New Label
        lblCondItem.Text = "実測値"
        lblCondItem.Top = TAB_TOP + CELL_HEIGNT - 1
        lblCondItem.Left = iCondLeft
        lblCondItem.Width = CELL_WIDTH0
        lblCondItem.Height = CELL_HEIGNT
        lblCondItem.BackColor = CELL_COLOR_NORMAL
        lblCondItem.BorderStyle = BorderStyle.FixedSingle
        lblCondItem.TextAlign = ContentAlignment.MiddleCenter

        ltlCondClamp(0) = New LiteralLabel
        ltlCondClamp(0).Literal = "(ton)"
        ltlCondClamp(0).Top = TAB_TOP + CELL_HEIGNT - 1
        ltlCondClamp(0).Left = lblCondItem.Right - 1
        ltlCondClamp(0).Width = CELL_WIDTH1
        ltlCondClamp(0).Height = CELL_HEIGNT
        ltlCondClamp(0).LiteralSize = 10
        AddHandler ltlCondClamp(0).Click, AddressOf LiteralLabel_Click

        ltlCondPlunger(0) = New LiteralLabel
        ltlCondPlunger(0).Literal = "(km/cm²)"
        ltlCondPlunger(0).Top = TAB_TOP + CELL_HEIGNT - 1
        ltlCondPlunger(0).Left = ltlCondClamp(0).Right - 1
        ltlCondPlunger(0).Width = CELL_WIDTH1
        ltlCondPlunger(0).Height = CELL_HEIGNT
        ltlCondPlunger(0).LiteralSize = 10
        AddHandler ltlCondPlunger(0).Click, AddressOf LiteralLabel_Click

        ltlCondDecompress(0) = New LiteralLabel
        ltlCondDecompress(0).Literal = "(mmHg)"
        ltlCondDecompress(0).Top = TAB_TOP + CELL_HEIGNT - 1
        ltlCondDecompress(0).Left = ltlCondPlunger(0).Right - 1
        ltlCondDecompress(0).Width = CELL_WIDTH1
        ltlCondDecompress(0).Height = CELL_HEIGNT
        ltlCondDecompress(0).LiteralSize = 10
        AddHandler ltlCondDecompress(0).Click, AddressOf LiteralLabel_Click

        ltlCondMovTime(0) = New LiteralLabel
        ltlCondMovTime(0).Literal = "(sec)"
        ltlCondMovTime(0).Top = TAB_TOP + CELL_HEIGNT - 1
        ltlCondMovTime(0).Left = ltlCondDecompress(0).Right - 1
        ltlCondMovTime(0).Width = CELL_WIDTH1
        ltlCondMovTime(0).Height = CELL_HEIGNT
        ltlCondMovTime(0).LiteralSize = 10
        AddHandler ltlCondMovTime(0).Click, AddressOf LiteralLabel_Click

        ltlCondMoldTime(0) = New LiteralLabel
        ltlCondMoldTime(0).Literal = "(sec)"
        ltlCondMoldTime(0).Top = TAB_TOP + CELL_HEIGNT - 1
        ltlCondMoldTime(0).Left = ltlCondMovTime(0).Right - 1
        ltlCondMoldTime(0).Width = CELL_WIDTH1
        ltlCondMoldTime(0).Height = CELL_HEIGNT
        ltlCondMoldTime(0).LiteralSize = 10
        AddHandler ltlCondMoldTime(0).Click, AddressOf LiteralLabel_Click

        tabCond.Controls.Add(lblCondItem)
        tabCond.Controls.AddRange(ltlCondClamp)
        tabCond.Controls.AddRange(ltlCondPlunger)
        tabCond.Controls.AddRange(ltlCondDecompress)
        tabCond.Controls.AddRange(ltlCondMovTime)
        tabCond.Controls.AddRange(ltlCondMoldTime)
    End Sub

    Private Const COND_Fx_Fz_G_YPC_YPM_YPS_ROW = 4
    Private Sub SetCondFx_Fz_G_YPC_YPM_YPS()
        SetTitleCond3()

        ReDim lblCondRowNo(COND_Fx_Fz_G_YPC_YPM_YPS_ROW)
        ReDim ltlCondClamp(COND_Fx_Fz_G_YPC_YPM_YPS_ROW)
        ReDim ltlCondPlunger(COND_Fx_Fz_G_YPC_YPM_YPS_ROW)
        ReDim ltlCondDecompress(COND_Fx_Fz_G_YPC_YPM_YPS_ROW)
        ReDim ltlCondMovTime(COND_Fx_Fz_G_YPC_YPM_YPS_ROW)
        ReDim ltlCondMoldTime(COND_Fx_Fz_G_YPC_YPM_YPS_ROW)

        lblCondItem = New Label
        lblCondItem.Text = "実測値"
        lblCondItem.Top = TAB_TOP + CELL_HEIGNT - 1
        lblCondItem.Left = iCondLeft
        lblCondItem.Width = CELL_WIDTH0
        lblCondItem.Height = CELL_HEIGNT * COND_Fx_Fz_G_YPC_YPM_YPS_ROW - COND_Fx_Fz_G_YPC_YPM_YPS_ROW + 1
        lblCondItem.BackColor = CELL_COLOR_NORMAL
        lblCondItem.BorderStyle = BorderStyle.FixedSingle
        lblCondItem.TextAlign = ContentAlignment.MiddleCenter

        Dim i As Integer
        For i = 0 To COND_Fx_Fz_G_YPC_YPM_YPS_ROW - 1

            lblCondRowNo(i) = New Label
            lblCondRowNo(i).Text = (i + 1).ToString
            lblCondRowNo(i).Top = TAB_TOP + CELL_HEIGNT + CELL_HEIGNT * i - i - 1
            lblCondRowNo(i).Left = lblCondItem.Right - 1
            lblCondRowNo(i).Width = CELL_WIDTH_HALF
            lblCondRowNo(i).Height = CELL_HEIGNT
            lblCondRowNo(i).BackColor = CELL_COLOR_NORMAL
            lblCondRowNo(i).BorderStyle = BorderStyle.FixedSingle
            lblCondRowNo(i).TextAlign = ContentAlignment.MiddleCenter

            ltlCondClamp(i) = New LiteralLabel
            ltlCondClamp(i).Literal = "(kN)"
            ltlCondClamp(i).Top = TAB_TOP + CELL_HEIGNT + CELL_HEIGNT * i - i - 1
            ltlCondClamp(i).Left = lblCondRowNo(0).Right - 1
            ltlCondClamp(i).Width = CELL_WIDTH1
            ltlCondClamp(i).Height = CELL_HEIGNT
            ltlCondClamp(i).LiteralSize = 10
            AddHandler ltlCondClamp(i).Click, AddressOf LiteralLabel_Click

            ltlCondPlunger(i) = New LiteralLabel
            ltlCondPlunger(i).Literal = "(kN)"
            ltlCondPlunger(i).Top = TAB_TOP + CELL_HEIGNT + CELL_HEIGNT * i - i - 1
            ltlCondPlunger(i).Left = ltlCondClamp(0).Right - 1
            ltlCondPlunger(i).Width = CELL_WIDTH1
            ltlCondPlunger(i).Height = CELL_HEIGNT
            ltlCondPlunger(i).LiteralSize = 10
            AddHandler ltlCondPlunger(i).Click, AddressOf LiteralLabel_Click

            ltlCondDecompress(i) = New LiteralLabel
            ltlCondDecompress(i).Literal = "(mmHg)"
            ltlCondDecompress(i).Top = TAB_TOP + CELL_HEIGNT + CELL_HEIGNT * i - i - 1
            ltlCondDecompress(i).Left = ltlCondPlunger(0).Right - 1
            ltlCondDecompress(i).Width = CELL_WIDTH1
            ltlCondDecompress(i).Height = CELL_HEIGNT
            ltlCondDecompress(i).LiteralSize = 10
            AddHandler ltlCondDecompress(i).Click, AddressOf LiteralLabel_Click

            ltlCondMovTime(i) = New LiteralLabel
            ltlCondMovTime(i).Literal = "(sec)"
            ltlCondMovTime(i).Top = TAB_TOP + CELL_HEIGNT + CELL_HEIGNT * i - i - 1
            ltlCondMovTime(i).Left = ltlCondDecompress(0).Right - 1
            ltlCondMovTime(i).Width = CELL_WIDTH1
            ltlCondMovTime(i).Height = CELL_HEIGNT
            ltlCondMovTime(i).LiteralSize = 10
            AddHandler ltlCondMovTime(i).Click, AddressOf LiteralLabel_Click

            ltlCondMoldTime(i) = New LiteralLabel
            ltlCondMoldTime(i).Literal = "(sec)"
            ltlCondMoldTime(i).Top = TAB_TOP + CELL_HEIGNT + CELL_HEIGNT * i - i - 1
            ltlCondMoldTime(i).Left = ltlCondMovTime(0).Right - 1
            ltlCondMoldTime(i).Width = CELL_WIDTH1
            ltlCondMoldTime(i).Height = CELL_HEIGNT
            ltlCondMoldTime(i).LiteralSize = 10
            AddHandler ltlCondMoldTime(i).Click, AddressOf LiteralLabel_Click
        Next

        tabCond.Controls.Add(lblCondItem)
        tabCond.Controls.AddRange(lblCondRowNo)
        tabCond.Controls.AddRange(ltlCondClamp)
        tabCond.Controls.AddRange(ltlCondPlunger)
        tabCond.Controls.AddRange(ltlCondDecompress)
        tabCond.Controls.AddRange(ltlCondMovTime)
        tabCond.Controls.AddRange(ltlCondMoldTime)
    End Sub

    Private Const Cond_PMC_ROW = 2
    Private Sub SetcondPMC()
        SetTitleCond4()

        ReDim lblCondRowNo(Cond_PMC_ROW)
        ReDim ltlCondClamp(Cond_PMC_ROW)
        ReDim ltlCondFmTime(Cond_PMC_ROW)
        ReDim ltlCondMovTime(Cond_PMC_ROW)
        ReDim ltlCondMoldTime(Cond_PMC_ROW)
        ReDim ltlCondTemp(0)

        lblCondItem = New Label
        lblCondItem.Text = "実測値"
        lblCondItem.Top = TAB_TOP + CELL_HEIGNT - 1
        lblCondItem.Left = iCondLeft
        lblCondItem.Width = CELL_WIDTH0
        lblCondItem.Height = CELL_HEIGNT * Cond_PMC_ROW - Cond_PMC_ROW + 1
        lblCondItem.BackColor = CELL_COLOR_NORMAL
        lblCondItem.BorderStyle = BorderStyle.FixedSingle
        lblCondItem.TextAlign = ContentAlignment.MiddleCenter

        Dim i As Integer
        For i = 0 To Cond_PMC_ROW - 1

            lblCondRowNo(i) = New Label
            lblCondRowNo(i).Text = (i + 1).ToString
            lblCondRowNo(i).Top = TAB_TOP + CELL_HEIGNT + CELL_HEIGNT * i - i - 1
            lblCondRowNo(i).Left = lblCondItem.Right - 1
            lblCondRowNo(i).Width = CELL_WIDTH_HALF
            lblCondRowNo(i).Height = CELL_HEIGNT
            lblCondRowNo(i).BackColor = CELL_COLOR_NORMAL
            lblCondRowNo(i).BorderStyle = BorderStyle.FixedSingle
            lblCondRowNo(i).TextAlign = ContentAlignment.MiddleCenter

            ltlCondClamp(i) = New LiteralLabel
            ltlCondClamp(i).Literal = "(kN)"
            ltlCondClamp(i).Top = TAB_TOP + CELL_HEIGNT + CELL_HEIGNT * i - i - 1
            ltlCondClamp(i).Left = lblCondRowNo(0).Right - 1
            ltlCondClamp(i).Width = CELL_WIDTH1
            ltlCondClamp(i).Height = CELL_HEIGNT
            ltlCondClamp(i).LiteralSize = 10
            AddHandler ltlCondClamp(i).Click, AddressOf LiteralLabel_Click

            ltlCondFmTime(i) = New LiteralLabel
            ltlCondFmTime(i).Literal = "(sec)"
            ltlCondFmTime(i).Top = TAB_TOP + CELL_HEIGNT + CELL_HEIGNT * i - i - 1
            ltlCondFmTime(i).Left = ltlCondClamp(0).Right - 1
            ltlCondFmTime(i).Width = CELL_WIDTH1
            ltlCondFmTime(i).Height = CELL_HEIGNT
            ltlCondFmTime(i).LiteralSize = 10
            AddHandler ltlCondFmTime(i).Click, AddressOf LiteralLabel_Click

            ltlCondMovTime(i) = New LiteralLabel
            ltlCondMovTime(i).Literal = "(sec)"
            ltlCondMovTime(i).Top = TAB_TOP + CELL_HEIGNT + CELL_HEIGNT * i - i - 1
            ltlCondMovTime(i).Left = ltlCondFmTime(0).Right - 1
            ltlCondMovTime(i).Width = CELL_WIDTH1
            ltlCondMovTime(i).Height = CELL_HEIGNT
            ltlCondMovTime(i).LiteralSize = 10
            AddHandler ltlCondMovTime(i).Click, AddressOf LiteralLabel_Click

            ltlCondMoldTime(i) = New LiteralLabel
            ltlCondMoldTime(i).Literal = "(sec)"
            ltlCondMoldTime(i).Top = TAB_TOP + CELL_HEIGNT + CELL_HEIGNT * i - i - 1
            ltlCondMoldTime(i).Left = ltlCondMovTime(0).Right - 1
            ltlCondMoldTime(i).Width = CELL_WIDTH1
            ltlCondMoldTime(i).Height = CELL_HEIGNT
            ltlCondMoldTime(i).LiteralSize = 10
            AddHandler ltlCondMoldTime(i).Click, AddressOf LiteralLabel_Click
        Next

        ltlCondTemp(0) = New LiteralLabel
        ltlCondTemp(0).Literal = "(℃)"
        ltlCondTemp(0).Top = TAB_TOP + CELL_HEIGNT - 1
        ltlCondTemp(0).Left = ltlCondMoldTime(0).Right - 1
        ltlCondTemp(0).Width = CELL_WIDTH1
        ltlCondTemp(0).Height = CELL_HEIGNT
        ltlCondTemp(0).LiteralSize = 10
        AddHandler ltlCondTemp(0).Click, AddressOf LiteralLabel_Click

        tabCond.Controls.Add(lblCondItem)
        tabCond.Controls.AddRange(lblCondRowNo)
        tabCond.Controls.AddRange(ltlCondClamp)
        tabCond.Controls.AddRange(ltlCondFmTime)
        tabCond.Controls.AddRange(ltlCondMovTime)
        tabCond.Controls.AddRange(ltlCondMoldTime)
        tabCond.Controls.AddRange(ltlCondTemp)
    End Sub

    Private Const COND_MAP_ROW = 2
    Private Sub SetCondMAP()
        SetTitleCond5_6()

        ReDim lblCondRowNo(COND_MAP_ROW)
        ReDim ltlCondClamp(COND_MAP_ROW)
        ReDim ltlCondPlunger(COND_MAP_ROW)
        ReDim ltlCondMoldTime(COND_MAP_ROW)

        lblCondItem = New Label
        lblCondItem.Text = "実測値"
        lblCondItem.Top = TAB_TOP + CELL_HEIGNT - 1
        lblCondItem.Left = iCondLeft
        lblCondItem.Width = CELL_WIDTH0
        lblCondItem.Height = CELL_HEIGNT * COND_MAP_ROW - COND_MAP_ROW + 1
        lblCondItem.BackColor = CELL_COLOR_NORMAL
        lblCondItem.BorderStyle = BorderStyle.FixedSingle
        lblCondItem.TextAlign = ContentAlignment.MiddleCenter

        Dim i As Integer
        For i = 0 To COND_MAP_ROW - 1

            lblCondRowNo(i) = New Label
            lblCondRowNo(i).Text = (i + 1).ToString
            lblCondRowNo(i).Top = TAB_TOP + CELL_HEIGNT + CELL_HEIGNT * i - i - 1
            lblCondRowNo(i).Left = lblCondItem.Right - 1
            lblCondRowNo(i).Width = CELL_WIDTH_HALF
            lblCondRowNo(i).Height = CELL_HEIGNT
            lblCondRowNo(i).BackColor = CELL_COLOR_NORMAL
            lblCondRowNo(i).BorderStyle = BorderStyle.FixedSingle
            lblCondRowNo(i).TextAlign = ContentAlignment.MiddleCenter

            ltlCondClamp(i) = New LiteralLabel
            ltlCondClamp(i).Literal = "(kN)"
            ltlCondClamp(i).Top = TAB_TOP + CELL_HEIGNT + CELL_HEIGNT * i - i - 1
            ltlCondClamp(i).Left = lblCondRowNo(0).Right - 1
            ltlCondClamp(i).Width = CELL_WIDTH1
            ltlCondClamp(i).Height = CELL_HEIGNT
            ltlCondClamp(i).LiteralSize = 10
            AddHandler ltlCondClamp(i).Click, AddressOf LiteralLabel_Click

            ltlCondPlunger(i) = New LiteralLabel
            ltlCondPlunger(i).Literal = "(kN)"
            ltlCondPlunger(i).Top = TAB_TOP + CELL_HEIGNT + CELL_HEIGNT * i - i - 1
            ltlCondPlunger(i).Left = ltlCondClamp(0).Right - 1
            ltlCondPlunger(i).Width = CELL_WIDTH1
            ltlCondPlunger(i).Height = CELL_HEIGNT
            ltlCondPlunger(i).LiteralSize = 10
            AddHandler ltlCondPlunger(i).Click, AddressOf LiteralLabel_Click

            ltlCondMoldTime(i) = New LiteralLabel
            ltlCondMoldTime(i).Literal = "(sec)"
            ltlCondMoldTime(i).Top = TAB_TOP + CELL_HEIGNT + CELL_HEIGNT * i - i - 1
            ltlCondMoldTime(i).Left = ltlCondPlunger(0).Right - 1
            ltlCondMoldTime(i).Width = CELL_WIDTH1
            ltlCondMoldTime(i).Height = CELL_HEIGNT
            ltlCondMoldTime(i).LiteralSize = 10
            AddHandler ltlCondMoldTime(i).Click, AddressOf LiteralLabel_Click
        Next

        tabCond.Controls.Add(lblCondItem)
        tabCond.Controls.AddRange(lblCondRowNo)
        tabCond.Controls.AddRange(ltlCondClamp)
        tabCond.Controls.AddRange(ltlCondPlunger)
        tabCond.Controls.AddRange(ltlCondMoldTime)
    End Sub

    Private Const COND_MAP2_ROW = 3
    Private Sub SetCondMAP2()
        SetTitleCond5_6()

        ReDim lblCondRowNo(COND_MAP2_ROW)
        ReDim ltlCondClamp(COND_MAP2_ROW)
        ReDim ltlCondPlunger(COND_MAP2_ROW)
        ReDim ltlCondMoldTime(COND_MAP2_ROW)

        lblCondItem = New Label
        lblCondItem.Text = "実測値"
        lblCondItem.Top = TAB_TOP + CELL_HEIGNT - 1
        lblCondItem.Left = iCondLeft
        lblCondItem.Width = CELL_WIDTH0
        lblCondItem.Height = CELL_HEIGNT * COND_MAP2_ROW - COND_MAP2_ROW + 1
        lblCondItem.BackColor = CELL_COLOR_NORMAL
        lblCondItem.BorderStyle = BorderStyle.FixedSingle
        lblCondItem.TextAlign = ContentAlignment.MiddleCenter

        Dim i As Integer
        For i = 0 To COND_MAP2_ROW - 1

            lblCondRowNo(i) = New Label
            lblCondRowNo(i).Text = (i + 1).ToString
            lblCondRowNo(i).Top = TAB_TOP + CELL_HEIGNT + CELL_HEIGNT * i - i - 1
            lblCondRowNo(i).Left = lblCondItem.Right - 1
            lblCondRowNo(i).Width = CELL_WIDTH_HALF
            lblCondRowNo(i).Height = CELL_HEIGNT
            lblCondRowNo(i).BackColor = CELL_COLOR_NORMAL
            lblCondRowNo(i).BorderStyle = BorderStyle.FixedSingle
            lblCondRowNo(i).TextAlign = ContentAlignment.MiddleCenter

            ltlCondClamp(i) = New LiteralLabel
            ltlCondClamp(i).Literal = "(kN)"
            ltlCondClamp(i).Top = TAB_TOP + CELL_HEIGNT + CELL_HEIGNT * i - i - 1
            ltlCondClamp(i).Left = lblCondRowNo(0).Right - 1
            ltlCondClamp(i).Width = CELL_WIDTH1
            ltlCondClamp(i).Height = CELL_HEIGNT
            ltlCondClamp(i).LiteralSize = 10
            AddHandler ltlCondClamp(i).Click, AddressOf LiteralLabel_Click

            ltlCondPlunger(i) = New LiteralLabel
            ltlCondPlunger(i).Literal = "(kN)"
            ltlCondPlunger(i).Top = TAB_TOP + CELL_HEIGNT + CELL_HEIGNT * i - i - 1
            ltlCondPlunger(i).Left = ltlCondClamp(0).Right - 1
            ltlCondPlunger(i).Width = CELL_WIDTH1
            ltlCondPlunger(i).Height = CELL_HEIGNT
            ltlCondPlunger(i).LiteralSize = 10
            AddHandler ltlCondPlunger(i).Click, AddressOf LiteralLabel_Click

            ltlCondMoldTime(i) = New LiteralLabel
            ltlCondMoldTime(i).Literal = "(sec)"
            ltlCondMoldTime(i).Top = TAB_TOP + CELL_HEIGNT + CELL_HEIGNT * i - i - 1
            ltlCondMoldTime(i).Left = ltlCondPlunger(0).Right - 1
            ltlCondMoldTime(i).Width = CELL_WIDTH1
            ltlCondMoldTime(i).Height = CELL_HEIGNT
            ltlCondMoldTime(i).LiteralSize = 10
            AddHandler ltlCondMoldTime(i).Click, AddressOf LiteralLabel_Click
        Next

        tabCond.Controls.Add(lblCondItem)
        tabCond.Controls.AddRange(lblCondRowNo)
        tabCond.Controls.AddRange(ltlCondClamp)
        tabCond.Controls.AddRange(ltlCondPlunger)
        tabCond.Controls.AddRange(ltlCondMoldTime)
    End Sub

    Private Sub SetTitleCond1_2()
        ReDim TitleCond(5)
        Dim i As Integer
        For i = 0 To TitleCond.Length - 1
            TitleCond(i) = New Label
            TitleCond(i).Top = TAB_TOP
            TitleCond(i).Height = CELL_HEIGNT
            TitleCond(i).BorderStyle = BorderStyle.FixedSingle
            TitleCond(i).TextAlign = ContentAlignment.MiddleCenter
            TitleCond(i).BackColor = CELL_COLOR_TITLE
        Next

        iCondLeft = (tabCond.Width - CELL_WIDTH0 - CELL_WIDTH1 - CELL_WIDTH1 - CELL_WIDTH1 - CELL_WIDTH1 - CELL_WIDTH1 + 5) / 2

        TitleCond(0).Text = "項目"
        TitleCond(0).Left = iCondLeft
        TitleCond(0).Width = CELL_WIDTH0
        TitleCond(1).Text = "クランプ圧力"
        TitleCond(1).Left = TitleCond(0).Right - 1
        TitleCond(1).Width = CELL_WIDTH1
        TitleCond(2).Text = "プランジャ圧力"
        TitleCond(2).Left = TitleCond(1).Right - 1
        TitleCond(2).Width = CELL_WIDTH1
        TitleCond(3).Text = "減圧"
        TitleCond(3).Left = TitleCond(2).Right - 1
        TitleCond(3).Width = CELL_WIDTH1
        TitleCond(4).Text = "移送時間"
        TitleCond(4).Left = TitleCond(3).Right - 1
        TitleCond(4).Width = CELL_WIDTH1
        TitleCond(5).Text = "モールド時間"
        TitleCond(5).Left = TitleCond(4).Right - 1
        TitleCond(5).Width = CELL_WIDTH1

        tabCond.Controls.AddRange(TitleCond)

    End Sub

    Private Sub SetTitleCond3()
        ReDim TitleCond(5)
        Dim i As Integer
        For i = 0 To TitleCond.Length - 1
            TitleCond(i) = New Label
            TitleCond(i).Top = TAB_TOP
            TitleCond(i).Height = CELL_HEIGNT
            TitleCond(i).BorderStyle = BorderStyle.FixedSingle
            TitleCond(i).TextAlign = ContentAlignment.MiddleCenter
            TitleCond(i).BackColor = CELL_COLOR_TITLE
        Next

        iCondLeft = (tabCond.Width - CELL_WIDTH0 - CELL_WIDTH_HALF - CELL_WIDTH1 - CELL_WIDTH1 - CELL_WIDTH1 - CELL_WIDTH1 - CELL_WIDTH1 + 6) / 2

        TitleCond(0).Text = "項目"
        TitleCond(0).Left = iCondLeft
        TitleCond(0).Width = CELL_WIDTH0 + CELL_WIDTH_HALF - 1
        TitleCond(1).Text = "クランプ圧力"
        TitleCond(1).Left = TitleCond(0).Right - 1
        TitleCond(1).Width = CELL_WIDTH1
        TitleCond(2).Text = "プランジャ圧力"
        TitleCond(2).Left = TitleCond(1).Right - 1
        TitleCond(2).Width = CELL_WIDTH1
        TitleCond(3).Text = "減圧"
        TitleCond(3).Left = TitleCond(2).Right - 1
        TitleCond(3).Width = CELL_WIDTH1
        TitleCond(4).Text = "移送時間"
        TitleCond(4).Left = TitleCond(3).Right - 1
        TitleCond(4).Width = CELL_WIDTH1
        TitleCond(5).Text = "モールド時間"
        TitleCond(5).Left = TitleCond(4).Right - 1
        TitleCond(5).Width = CELL_WIDTH1

        tabCond.Controls.AddRange(TitleCond)
    End Sub

    Private Sub SetTitleCond4()
        ReDim TitleCond(5)
        Dim i As Integer
        For i = 0 To TitleCond.Length - 1
            TitleCond(i) = New Label
            TitleCond(i).Top = TAB_TOP
            TitleCond(i).Height = CELL_HEIGNT
            TitleCond(i).BorderStyle = BorderStyle.FixedSingle
            TitleCond(i).TextAlign = ContentAlignment.MiddleCenter
            TitleCond(i).BackColor = CELL_COLOR_TITLE
        Next

        iCondLeft = (tabCond.Width - CELL_WIDTH0 - CELL_WIDTH_HALF - CELL_WIDTH1 - CELL_WIDTH1 - CELL_WIDTH1 - CELL_WIDTH1 - CELL_WIDTH1 + 6) / 2

        TitleCond(0).Text = "項目"
        TitleCond(0).Left = iCondLeft
        TitleCond(0).Width = CELL_WIDTH0 + CELL_WIDTH_HALF - 1
        TitleCond(1).Text = "圧縮圧力" & vbCrLf & "(CL圧力)"
        TitleCond(1).Left = TitleCond(0).Right - 1
        TitleCond(1).Width = CELL_WIDTH1
        TitleCond(1).Font = New Font("", 12)
        TitleCond(2).Text = "FM時間" & vbCrLf & "(FM待機時間)"
        TitleCond(2).Left = TitleCond(1).Right - 1
        TitleCond(2).Width = CELL_WIDTH1
        TitleCond(2).Font = New Font("", 12)
        TitleCond(3).Text = "成形時間"
        TitleCond(3).Left = TitleCond(2).Right - 1
        TitleCond(3).Width = CELL_WIDTH1
        TitleCond(4).Text = "モールド時間" & vbCrLf & "(キュアタイム)"
        TitleCond(4).Left = TitleCond(3).Right - 1
        TitleCond(4).Width = CELL_WIDTH1
        TitleCond(4).Font = New Font("", 12)
        TitleCond(5).Text = "レジン供給部" & vbCrLf & "クーラ温度"
        TitleCond(5).Left = TitleCond(4).Right - 1
        TitleCond(5).Width = CELL_WIDTH1
        TitleCond(5).Font = New Font("", 12)

        tabCond.Controls.AddRange(TitleCond)
    End Sub

    Private Sub SetTitleCond5_6()
        ReDim TitleCond(3)
        Dim i As Integer
        For i = 0 To TitleCond.Length - 1
            TitleCond(i) = New Label
            TitleCond(i).Top = TAB_TOP
            TitleCond(i).Height = CELL_HEIGNT
            TitleCond(i).BorderStyle = BorderStyle.FixedSingle
            TitleCond(i).TextAlign = ContentAlignment.MiddleCenter
            TitleCond(i).BackColor = CELL_COLOR_TITLE
        Next

        iCondLeft = (tabCond.Width - CELL_WIDTH0 - CELL_WIDTH_HALF - CELL_WIDTH1 - CELL_WIDTH1 - CELL_WIDTH1 + 4) / 2

        TitleCond(0).Text = "項目"
        TitleCond(0).Left = iCondLeft
        TitleCond(0).Width = CELL_WIDTH0 + CELL_WIDTH_HALF - 1
        TitleCond(1).Text = "クランプ圧力"
        TitleCond(1).Left = TitleCond(0).Right - 1
        TitleCond(1).Width = CELL_WIDTH1
        TitleCond(2).Text = "プランジャ圧力"
        TitleCond(2).Left = TitleCond(1).Right - 1
        TitleCond(2).Width = CELL_WIDTH1
        TitleCond(3).Text = "モールド時間"
        TitleCond(3).Left = TitleCond(2).Right - 1
        TitleCond(3).Width = CELL_WIDTH1

        tabCond.Controls.AddRange(TitleCond)

    End Sub

#End Region

#Region "動作"


    'Private Sub ltlCond_Click(ByVal sender As Object, ByVal e As EventArgs)
    '    Dim ltl As LiteralLabel = CType(sender, LiteralLabel)
    '    CallTenkey(ltl.InputLabel)
    'End Sub
#End Region

#Region "初期化"
    Private Sub InitTabCond()
        SetTabCond()
    End Sub
#End Region

#Region "保存"

    Const szTagCondClamp = "CondClamp{0}"
    Const szTagCondPlunger = "CondPlunger{0}"
    Const szTagCondDecmprs = "CondDecmprs{0}"
    Const szTagCondMove = "CondMove{0}"
    Const szTagCondMoldTM = "CondMoldTM{0}"
    Const szTagCondFmTM = "CondFmTM{0}"
    Const szTagCondShapeTm = "CondShapeTm{0}"
    Const szTagCondCoolerTmp = "CondCoolerTmp"

    Private Sub btnCondSave_Click(ByVal sender As Object, ByVal e As System.EventArgs)
        Dim lstData As New List(Of String())
        lstData.Add({bccEquipID.Text, "ICTAG_LOT", bccEquipID.Text, szTagSeries, m_MoldSeries.ToString})
        lstData.Add({bccEquipID.Text, "ICTAG_LOT", bccEquipID.Text, szTagEquipID, bccEquipID.Text})
        lstData.Add({bccEquipID.Text, "ICTAG_LOT", bccEquipID.Text, szTagProcs, tabTool.Text})
        lstData.Add({bccEquipID.Text, "ICTAG_LOT", bccEquipID.Text, szTagLotNo, "ICTAG_LOT"})
        lstData.Add({bccEquipID.Text, "ICTAG_LOT", bccEquipID.Text, szTagBeginTM, ""})

        Select Case m_MoldSeries
            Case MoldSeries.ATOM_100PF
                SaveCond1(lstData)
            Case MoldSeries.ATOM_500F
                SaveCond2(lstData)
            Case MoldSeries.ATOM_FX_FS
                SaveCond3(lstData)
            Case MoldSeries.ATOM_FZ
                SaveCond3(lstData)
            Case MoldSeries.G_LINE
                SaveCond3(lstData)
            Case MoldSeries.Y_PC
                SaveCond3(lstData)
            Case MoldSeries.YPM
                SaveCond3(lstData)
            Case MoldSeries.YPS
                SaveCond3(lstData)
            Case MoldSeries.PMC
                SaveCond4(lstData)
            Case MoldSeries.YPM_MAP
                SaveCond5(lstData)
            Case MoldSeries.YPS_MAP
                SaveCond5(lstData)
            Case MoldSeries.YPS_MAP2
                SaveCond6(lstData)
        End Select

        m_cTenken.SaveSwapMold(lstData, bccEquipID.Text, "ICTAG_LOT", "")
    End Sub

    Private Sub SaveCond1(ByRef lstData As List(Of String()))
        lstData.Add({bccEquipID.Text, "ICTAG_LOT", String.Format(szTagCondClamp, 1), ltlCondClamp(0).Text})
        lstData.Add({bccEquipID.Text, "ICTAG_LOT", String.Format(szTagCondPlunger, 1), ltlCondPlunger(0).Text})
        lstData.Add({bccEquipID.Text, "ICTAG_LOT", String.Format(szTagCondDecmprs, 1), ltlCondDecompress(0).Text})
        lstData.Add({bccEquipID.Text, "ICTAG_LOT", String.Format(szTagCondMove, 1), ltlCondMovTime(0).Text})
        lstData.Add({bccEquipID.Text, "ICTAG_LOT", String.Format(szTagCondMoldTM, 1), ltlCondMoldTime(0).Text})
    End Sub

    Private Sub SaveCond2(ByRef lstData As List(Of String()))
        lstData.Add({bccEquipID.Text, "ICTAG_LOT", String.Format(szTagCondClamp, 1), ltlCondClamp(0).Text})
        lstData.Add({bccEquipID.Text, "ICTAG_LOT", String.Format(szTagCondPlunger, 1), ltlCondPlunger(0).Text})
        lstData.Add({bccEquipID.Text, "ICTAG_LOT", String.Format(szTagCondDecmprs, 1), ltlCondDecompress(0).Text})
        lstData.Add({bccEquipID.Text, "ICTAG_LOT", String.Format(szTagCondMove, 1), ltlCondMovTime(0).Text})
        lstData.Add({bccEquipID.Text, "ICTAG_LOT", String.Format(szTagCondMoldTM, 1), ltlCondMoldTime(0).Text})
    End Sub

    Private Sub SaveCond3(ByRef lstData As List(Of String()))
        Dim i As Integer
        For i = 0 To 3
            lstData.Add({bccEquipID.Text, "ICTAG_LOT", String.Format(szTagCondClamp, i + 1), ltlCondClamp(i).Text})
            lstData.Add({bccEquipID.Text, "ICTAG_LOT", String.Format(szTagCondPlunger, i + 1), ltlCondPlunger(i).Text})
            lstData.Add({bccEquipID.Text, "ICTAG_LOT", String.Format(szTagCondDecmprs, i + 1), ltlCondDecompress(i).Text})
            lstData.Add({bccEquipID.Text, "ICTAG_LOT", String.Format(szTagCondMove, i + 1), ltlCondMovTime(i).Text})
            lstData.Add({bccEquipID.Text, "ICTAG_LOT", String.Format(szTagCondMoldTM, i + 1), ltlCondMoldTime(i).Text})
        Next
    End Sub

    Private Sub SaveCond4(ByRef lstData As List(Of String()))
        Dim i As Integer
        For i = 0 To 1
            lstData.Add({bccEquipID.Text, "ICTAG_LOT", String.Format(szTagCondClamp, i + 1), ltlCondClamp(i).Text})
            lstData.Add({bccEquipID.Text, "ICTAG_LOT", String.Format(szTagCondFmTM, i + 1), ltlCondFmTime(i).Text})
            lstData.Add({bccEquipID.Text, "ICTAG_LOT", String.Format(szTagCondShapeTm, i + 1), ltlCondMovTime(i).Text})
            lstData.Add({bccEquipID.Text, "ICTAG_LOT", String.Format(szTagCondMoldTM, i + 1), ltlCondMoldTime(i).Text})
        Next
        lstData.Add({bccEquipID.Text, "ICTAG_LOT", szTagCondCoolerTmp, ltlCondTemp(0).Text})
    End Sub

    Private Sub SaveCond5(ByRef lstData As List(Of String()))
        Dim i As Integer
        For i = 0 To 1
            lstData.Add({bccEquipID.Text, "ICTAG_LOT", String.Format(szTagCondClamp, i + 1), ltlCondClamp(i).Text})
            lstData.Add({bccEquipID.Text, "ICTAG_LOT", String.Format(szTagCondPlunger, i + 1), ltlCondPlunger(i).Text})
            lstData.Add({bccEquipID.Text, "ICTAG_LOT", String.Format(szTagCondMoldTM, i + 1), ltlCondMoldTime(i).Text})
        Next
    End Sub

    Private Sub SaveCond6(ByRef lstData As List(Of String()))
        Dim i As Integer
        For i = 0 To 2
            lstData.Add({bccEquipID.Text, "ICTAG_LOT", String.Format(szTagCondClamp, i + 1), ltlCondClamp(i).Text})
            lstData.Add({bccEquipID.Text, "ICTAG_LOT", String.Format(szTagCondPlunger, i + 1), ltlCondPlunger(i).Text})
            lstData.Add({bccEquipID.Text, "ICTAG_LOT", String.Format(szTagCondMoldTM, i + 1), ltlCondMoldTime(i).Text})
        Next
    End Sub

#End Region

#End Region

#Region "金型温度"

#Region "表示内容"
    Private Sub SetTabTemp()

        Select Case m_MoldSeries
            Case MoldSeries.ATOM_100PF
                SetTabTemp1()
            Case MoldSeries.ATOM_500F
                SetTabTemp2()
            Case MoldSeries.ATOM_FX_FS
                SetTabTemp4()
            Case MoldSeries.ATOM_FZ
                SetTabTemp4()
            Case MoldSeries.G_LINE
                SetTabTemp4()
            Case MoldSeries.Y_PC
                SetTabTemp4()
            Case MoldSeries.YPM
                SetTabTemp4()
            Case MoldSeries.YPS
                SetTabTemp4()
            Case MoldSeries.PMC
                SetTabTemp5()
            Case MoldSeries.YPM_MAP
                SetTabTemp2()
            Case MoldSeries.YPS_MAP
                SetTabTemp2()
            Case MoldSeries.YPS_MAP2
                SetTabTemp3()
        End Select
    End Sub

    Private Sub SetTabTemp1()
        PanelTemp1.Visible = True
        PanelTemp1.Location = New Point(0, 0)
        PanelTemp1.Size = tabTemp.Size
        PanelTemp2.Visible = False
        PanelTemp3.Visible = False
        PanelTemp4.Visible = False
        PanelTemp5.Visible = False
    End Sub

    Private Sub SetTabTemp2()
        PanelTemp1.Visible = False
        PanelTemp2.Visible = True
        PanelTemp2.Location = New Point(0, 0)
        PanelTemp2.Size = tabTemp.Size
        PanelTemp3.Visible = False
        PanelTemp4.Visible = False
        PanelTemp5.Visible = False
    End Sub

    Private Sub SetTabTemp3()
        PanelTemp1.Visible = False
        PanelTemp2.Visible = False
        PanelTemp3.Visible = True
        PanelTemp3.Location = New Point(0, 0)
        PanelTemp3.Size = tabTemp.Size
        PanelTemp4.Visible = False
        PanelTemp5.Visible = False
    End Sub

    Private Sub SetTabTemp4()
        PanelTemp1.Visible = False
        PanelTemp2.Visible = False
        PanelTemp3.Visible = False
        PanelTemp4.Visible = True
        PanelTemp4.Location = New Point(0, 0)
        PanelTemp4.Size = tabTemp.Size
        PanelTemp5.Visible = False
    End Sub

    Private Sub SetTabTemp5()
        PanelTemp1.Visible = False
        PanelTemp2.Visible = False
        PanelTemp3.Visible = False
        PanelTemp4.Visible = False
        PanelTemp5.Visible = True
        PanelTemp5.Location = New Point(0, 0)
        PanelTemp5.Size = tabTemp.Size
    End Sub

#End Region

#Region "初期化"
    Private Sub InitTabTemp()
        For Each ctrl As Control In PanelTemp1.Controls
            If ctrl.GetType = ToolTemp1_1.GetType Then
                ctrl = CType(ctrl, ToolTempH)
                AddHandler ctrl.Click, AddressOf ToolTempH_Click
            ElseIf ctrl.GetType = ToolTemp2_1.GetType Then
                ctrl = CType(ctrl, ToolTempV)
                AddHandler ctrl.Click, AddressOf ToolTempV_Click
            End If
        Next

        For Each ctrl As Control In PanelTemp2.Controls
            If ctrl.GetType = ToolTemp1_1.GetType Then
                ctrl = CType(ctrl, ToolTempH)
                AddHandler ctrl.Click, AddressOf ToolTempH_Click
            ElseIf ctrl.GetType = ToolTemp2_1.GetType Then
                ctrl = CType(ctrl, ToolTempV)
                AddHandler ctrl.Click, AddressOf ToolTempV_Click
            End If
        Next

        For Each ctrl As Control In PanelTemp3.Controls
            If ctrl.GetType = ToolTemp1_1.GetType Then
                ctrl = CType(ctrl, ToolTempH)
                AddHandler ctrl.Click, AddressOf ToolTempH_Click
            ElseIf ctrl.GetType = ToolTemp2_1.GetType Then
                ctrl = CType(ctrl, ToolTempV)
                AddHandler ctrl.Click, AddressOf ToolTempV_Click
            End If
        Next

        For Each ctrl As Control In PanelTemp4.Controls
            If ctrl.GetType = ToolTemp1_1.GetType Then
                ctrl = CType(ctrl, ToolTempH)
                AddHandler ctrl.Click, AddressOf ToolTempH_Click
            ElseIf ctrl.GetType = ToolTemp2_1.GetType Then
                ctrl = CType(ctrl, ToolTempV)
                AddHandler ctrl.Click, AddressOf ToolTempV_Click
            End If
        Next

        For Each ctrlP As Control In PanelTemp5.Controls
            If ctrlP.GetType = panelTemp5_1.GetType Then
                For Each ctrl As Control In ctrlP.Controls
                    If ctrl.GetType = ToolTemp1_1.GetType Then
                        ctrl = CType(ctrl, ToolTempH)
                        AddHandler ctrl.Click, AddressOf ToolTempH_Click
                    ElseIf ctrl.GetType = ToolTemp2_1.GetType Then
                        ctrl = CType(ctrl, ToolTempV)
                        AddHandler ctrl.Click, AddressOf ToolTempV_Click
                    End If
                Next
            End If
        Next

        SetTabTemp()
    End Sub
#End Region

#Region "動作"
    Private Sub ToolTempH_Click(ByVal sender As Object, ByVal e As EventArgs)
        Dim tth As ToolTempH = CType(sender, ToolTempH)
        Dim tkl As TenKeyLabel = tth.InputLabel
        Dim pt2Screen As Point = tkl.PointToScreen(New Point(0, 0))
        CallTenkey(tkl, pt2Screen.X - Me.Left, pt2Screen.Y - Me.Top)
    End Sub

    Private Sub ToolTempV_Click(ByVal sender As Object, ByVal e As EventArgs)
        Dim ttv As ToolTempV = CType(sender, ToolTempV)
        Dim tkl As TenKeyLabel = ttv.InputLabel
        Dim pt2Screen As Point = tkl.PointToScreen(New Point(0, 0))
        CallTenkey(tkl, pt2Screen.X - Me.Left, pt2Screen.Y - Me.Top)
    End Sub
#End Region

#Region "保存"

    Const szTagTemp = "Temp{0}"

    Private Sub btnTempSave_Click(ByVal sender As Object, ByVal e As System.EventArgs)
        Dim lstData As New List(Of String())
        lstData.Add({bccEquipID.Text, "ICTAG_LOT", bccEquipID.Text, szTagSeries, m_MoldSeries.ToString})
        lstData.Add({bccEquipID.Text, "ICTAG_LOT", bccEquipID.Text, szTagEquipID, bccEquipID.Text})
        lstData.Add({bccEquipID.Text, "ICTAG_LOT", bccEquipID.Text, szTagProcs, tabTool.Text})
        lstData.Add({bccEquipID.Text, "ICTAG_LOT", bccEquipID.Text, szTagLotNo, "ICTAG_LOT"})
        lstData.Add({bccEquipID.Text, "ICTAG_LOT", bccEquipID.Text, szTagBeginTM, ""})

        Select Case m_MoldSeries
            Case MoldSeries.ATOM_100PF
                SaveTemp1(lstData)
            Case MoldSeries.ATOM_500F
                SaveTemp2(lstData)
            Case MoldSeries.ATOM_FX_FS
                SaveTemp4(lstData)
            Case MoldSeries.ATOM_FZ
                SaveTemp4(lstData)
            Case MoldSeries.G_LINE
                SaveTemp4(lstData)
            Case MoldSeries.Y_PC
                SaveTemp4(lstData)
            Case MoldSeries.YPM
                SaveTemp4(lstData)
            Case MoldSeries.YPS
                SaveTemp4(lstData)
            Case MoldSeries.PMC
                SaveTemp5(lstData)
            Case MoldSeries.YPM_MAP
                SaveTemp2(lstData)
            Case MoldSeries.YPS_MAP
                SaveTemp2(lstData)
            Case MoldSeries.YPS_MAP2
                SaveTemp3(lstData)
        End Select

        m_cTenken.SaveSwapMold(lstData, bccEquipID.Text, "ICTAG_LOT", "")
    End Sub

    Private Sub SaveTemp1(ByRef lstData As List(Of String()))
        Dim i As Integer = 1
        For Each ctrl As Control In PanelTemp1.Controls
            If ctrl.GetType = ToolTemp1_1.GetType Then
                Dim tth = CType(ctrl, ToolTempH)
                lstData.Add({bccEquipID.Text, "ICTAG_LOT", String.Format(szTagTemp, i), tth.Tempreture1})
                lstData.Add({bccEquipID.Text, "ICTAG_LOT", String.Format(szTagTemp, i + 1), tth.Tempreture2})
                i += 2
            End If
        Next
        lstData.Add({bccEquipID.Text, "ICTAG_LOT", String.Format(szTagCondClamp, 1), ltlCondClamp(0).Text})
    End Sub

    Private Sub SaveTemp2(ByRef lstData As List(Of String()))
        Dim i As Integer = 1
        For Each ctrl As Control In PanelTemp2.Controls
            If ctrl.GetType = ToolTemp2_1.GetType Then
                Dim ttv = CType(ctrl, ToolTempV)
                lstData.Add({bccEquipID.Text, "ICTAG_LOT", String.Format(szTagTemp, i), ttv.Tempreture1})
                lstData.Add({bccEquipID.Text, "ICTAG_LOT", String.Format(szTagTemp, i + 1), ttv.Tempreture2})
                i += 2
            End If
        Next
    End Sub

    Private Sub SaveTemp3(ByRef lstData As List(Of String()))
        Dim i As Integer = 1
        For Each ctrl As Control In PanelTemp3.Controls
            If ctrl.GetType = ToolTemp2_1.GetType Then
                Dim ttv = CType(ctrl, ToolTempV)
                lstData.Add({bccEquipID.Text, "ICTAG_LOT", String.Format(szTagTemp, i), ttv.Tempreture1})
                lstData.Add({bccEquipID.Text, "ICTAG_LOT", String.Format(szTagTemp, i + 1), ttv.Tempreture2})
                i += 2
            End If
        Next
    End Sub

    Private Sub SaveTemp4(ByRef lstData As List(Of String()))
        Dim i As Integer = 1
        For Each ctrl As Control In PanelTemp4.Controls
            If ctrl.GetType = ToolTemp2_1.GetType Then
                Dim ttv = CType(ctrl, ToolTempV)
                lstData.Add({bccEquipID.Text, "ICTAG_LOT", String.Format(szTagTemp, i), ttv.Tempreture1})
                lstData.Add({bccEquipID.Text, "ICTAG_LOT", String.Format(szTagTemp, i + 1), ttv.Tempreture2})
                i += 2
            End If
        Next
    End Sub

    Private Sub SaveTemp5(ByRef lstData As List(Of String()))
        Dim i As Integer = 1
        For Each ctrl As Control In PanelTemp5.Controls
            If ctrl.GetType = ToolTemp1_1.GetType Then
                Dim tth = CType(ctrl, ToolTempH)
                lstData.Add({bccEquipID.Text, "ICTAG_LOT", String.Format(szTagTemp, i), tth.Tempreture1})
                lstData.Add({bccEquipID.Text, "ICTAG_LOT", String.Format(szTagTemp, i + 1), tth.Tempreture2})
                i += 2
            End If
        Next
        For Each ctrlP As Control In PanelTemp5.Controls
            If ctrlP.GetType = panelTemp5_1.GetType Then
                For Each ctrl As Control In ctrlP.Controls
                    If ctrl.GetType = ToolTemp1_1.GetType Then
                        Dim tth = CType(ctrl, ToolTempH)
                        lstData.Add({bccEquipID.Text, "ICTAG_LOT", String.Format(szTagTemp, i), tth.Tempreture1})
                        lstData.Add({bccEquipID.Text, "ICTAG_LOT", String.Format(szTagTemp, i + 1), tth.Tempreture2})
                        i += 2
                    End If
                Next
            End If
        Next
        lstData.Add({bccEquipID.Text, "ICTAG_LOT", String.Format(szTagCondClamp, 1), ltlCondClamp(0).Text})
    End Sub

#End Region

#End Region

#Region "金型掃除"

#Region "表示内容"
    Private Sub SetTabClean()

        Select Case m_MoldSeries
            Case MoldSeries.ATOM_100PF
                SetTabClean1()
            Case MoldSeries.ATOM_500F
                SetTabClean2()
            Case MoldSeries.ATOM_FX_FS
                SetTabClean3()
            Case MoldSeries.ATOM_FZ
                SetTabClean3()
            Case MoldSeries.G_LINE
                SetTabClean4()
            Case MoldSeries.Y_PC
                SetTabClean3()
            Case MoldSeries.YPS
                SetTabClean3()
            Case MoldSeries.YPM
                SetTabClean3()
            Case MoldSeries.PMC
                SetTabClean7()
            Case MoldSeries.YPM_MAP
                SetTabClean5()
            Case MoldSeries.YPS_MAP
                SetTabClean5()
            Case MoldSeries.YPS_MAP2
                SetTabClean5()
        End Select
    End Sub

    Private Const CELL_HEIGHT_CLEAN = 40
    Private Const CELL_TOP_CLEAN = 160

    Private Sub SetTabClean1()
        SetCleanResinHeader(True)
        SetCleanResin(False, 1)
        SetCleanResin(True, 2, 0)
        SetCleanResin(True, 3, 1)
        SetCleanResin(True, 4, 2)
        SetCleanRslt(True, 1, 3)
        SetCleanRslt(False, 2)
        SetCleanRslt(False, 3)
        SetCleanRslt(False, 4)
    End Sub

    Private Sub SetTabClean2()
        SetCleanResinHeader(True)
        SetCleanResin(True, 1, 0)
        SetCleanResin(True, 2, 1)
        SetCleanResin(True, 3, 2)
        SetCleanResin(True, 4, 3)
        SetCleanRslt(True, 1, 4)
        SetCleanRslt(False, 2)
        SetCleanRslt(False, 3)
        SetCleanRslt(False, 4)
    End Sub

    Private Sub SetTabClean3()
        SetCleanResinHeader(True)
        SetCleanResin(True, 1, 0)
        SetCleanResin(True, 2, 1)
        SetCleanResin(True, 3, 2)
        SetCleanResin(True, 4, 3)
        SetCleanRslt(True, 1, 4)
        SetCleanRslt(True, 2, 5)
        SetCleanRslt(True, 3, 6)
        SetCleanRslt(True, 4, 7)
    End Sub

    Private Sub SetTabClean4()
        SetCleanResinHeader(True)
        SetCleanResin(False, 1)
        SetCleanResin(True, 2, 0)
        SetCleanResin(True, 3, 1)
        SetCleanResin(True, 4, 2)
        SetCleanRslt(True, 1, 3)
        SetCleanRslt(False, 2)
        SetCleanRslt(False, 3)
        SetCleanRslt(False, 4)
    End Sub

    Private Sub SetTabClean5()
        SetCleanResinHeader(True)
        SetCleanResin(False, 1)
        SetCleanResin(True, 2, 0)
        SetCleanResin(True, 3, 1)
        SetCleanResin(True, 4, 2)
        SetCleanRslt(True, 1, 3)
        SetCleanRslt(True, 2, 4)
        SetCleanRslt(False, 3)
        SetCleanRslt(False, 4)
    End Sub

    Private Sub SetTabClean6()
        SetCleanResinHeader(True)
        SetCleanResin(False, 1)
        SetCleanResin(True, 2, 0)
        SetCleanResin(True, 3, 1)
        SetCleanResin(True, 4, 2)
        SetCleanRslt(True, 1, 3)
        SetCleanRslt(True, 2, 4)
        SetCleanRslt(True, 3, 5)
        SetCleanRslt(False, 4)
    End Sub

    Private Sub SetTabClean7()
        SetCleanResinHeader(False)
    End Sub

    Private Sub SetCleanResinHeader(ByVal fIsShowed As Boolean)
        lblCleanResinNm.Visible = fIsShowed
        lblCleanCureTm.Visible = fIsShowed
        lblCleanOpTm.Visible = fIsShowed

        If Not fIsShowed Then
            Dim i As Integer
            For i = 1 To 4
                SetCleanResin(False, i)
                SetCleanRslt(False, i)
            Next
        End If
    End Sub

    Private Sub SetCleanResin(ByVal fIsShowed As Boolean, _
                               ByVal idx As Integer, _
                            Optional ByVal iPos As Integer = -1)
        Dim lblClean As Label = tabClean.Controls.Find("lblClean" & idx.ToString, False)(0)
        Dim ltlCleanMin As LiteralLabel = tabClean.Controls.Find("ltlCleanMin" & idx.ToString, False)(0)
        Dim ltlCleanTm As LiteralLabel = tabClean.Controls.Find("ltlCleanTm" & idx.ToString, False)(0)

        lblClean.Visible = fIsShowed
        ltlCleanMin.Visible = fIsShowed
        ltlCleanTm.Visible = fIsShowed

        If Not fIsShowed Then
            Exit Sub
        End If

        lblClean.Top = CELL_TOP_CLEAN + CELL_HEIGHT_CLEAN * iPos - iPos
        ltlCleanMin.Top = CELL_TOP_CLEAN + CELL_HEIGHT_CLEAN * iPos - iPos
        ltlCleanTm.Top = CELL_TOP_CLEAN + CELL_HEIGHT_CLEAN * iPos - iPos
    End Sub

    Private Sub SetCleanRslt(ByVal fIsShowed As Boolean, _
                              ByVal idx As Integer, _
                            Optional ByVal iPos As Integer = -1)

        Dim lblCleanAppl As Label = tabClean.Controls.Find("lblCleanAppl" & idx.ToString, False)(0)
        Dim aprClean As AppearenceResult = tabClean.Controls.Find("aprClean" & idx.ToString, False)(0)

        lblCleanAppl.Visible = fIsShowed
        aprClean.Visible = fIsShowed

        If Not fIsShowed Then
            Exit Sub
        End If

        lblCleanAppl.Top = CELL_TOP_CLEAN + CELL_HEIGHT_CLEAN * iPos - iPos
        aprClean.Top = CELL_TOP_CLEAN + CELL_HEIGHT_CLEAN * iPos - iPos
    End Sub

#End Region

#Region "動作"
    Private tklClean As TenKeyLabel

    Private Sub LiteralLabelClean_Click(ByVal sender As Object, ByVal e As EventArgs)
        Dim ltl As LiteralLabel = CType(sender, LiteralLabel)
        If Not IsNothing(tklClean) Then
            If Not tklClean.Parent.Name.Equals(ltl.Name) Then
                tklClean.EndEdit()
            End If
        End If
        tklClean = ltl.InputLabel
        IncDecClean.Enabled = True
        IncDecClean.SetLabel(tklClean)
    End Sub

    Private Sub tabClean_Leave(ByVal sender As Object, ByVal e As System.EventArgs) Handles tabClean.Leave
        If Not IsNothing(tklClean) Then
            tklClean.EndEdit()
        End If
    End Sub

    Private Sub tabClean_LostFocus(ByVal sender As Object, ByVal e As System.EventArgs) Handles tabClean.LostFocus
        If Not IsNothing(tklClean) Then
            tklClean.EndEdit()
        End If
    End Sub

    Private Sub ltlCleanTime_InputCompleted(ByVal sender As Object)
        tklClean = Nothing
        'IncDecClean.ClearLabel()
        IncDecClean.Enabled = False
    End Sub

    Private Sub dncClean_Selected(ByVal sender As Object, ByVal e As DncEventArgs) Handles dncClean.Selected
        dnc1.SetButon(e.DayNight, e.Result)
    End Sub

#End Region

#Region "初期化"
    Private Sub InitTabClean()
        AddHandler tklCleanBegin.Click, AddressOf tklDate_Click
        AddHandler tklCleanEnd.Click, AddressOf tklDate_Click

        AddHandler aprClean1.Click, AddressOf AppearenceResult_Click
        AddHandler aprClean2.Click, AddressOf AppearenceResult_Click
        AddHandler aprClean3.Click, AddressOf AppearenceResult_Click
        AddHandler aprClean4.Click, AddressOf AppearenceResult_Click

        AddHandler ltlCleanMin1.Click, AddressOf LiteralLabel_Click
        AddHandler ltlCleanMin2.Click, AddressOf LiteralLabel_Click
        AddHandler ltlCleanMin3.Click, AddressOf LiteralLabel_Click
        AddHandler ltlCleanMin4.Click, AddressOf LiteralLabel_Click

        AddHandler ltlCleanTm1.Click, AddressOf LiteralLabelClean_Click
        AddHandler ltlCleanTm2.Click, AddressOf LiteralLabelClean_Click
        AddHandler ltlCleanTm3.Click, AddressOf LiteralLabelClean_Click
        AddHandler ltlCleanTm4.Click, AddressOf LiteralLabelClean_Click

        AddHandler ltlCleanTm1.InputCompleted, AddressOf ltlCleanTime_InputCompleted
        AddHandler ltlCleanTm2.InputCompleted, AddressOf ltlCleanTime_InputCompleted
        AddHandler ltlCleanTm3.InputCompleted, AddressOf ltlCleanTime_InputCompleted
        AddHandler ltlCleanTm4.InputCompleted, AddressOf ltlCleanTime_InputCompleted

        SetTabClean()
    End Sub
#End Region

#Region "保存"

    Const szTagCleanGumMin = "CleanGumMin"
    Const szTagCleanGumTm = "CleanGumTm"
    Const szTagCleanResinMin1 = "CleanResinMin1"
    Const szTagCleanResinTm1 = "CleanResinTm1"
    Const szTagCleanCelMin = "CleanCelMin"
    Const szTagCleanCelTm = "CleanCelTm"
    Const szTagCleanResinMin2 = "CleanResinMin2"
    Const szTagCleanResinTm2 = "CleanResinTm2"
    Const szTagCleanRslt = "CleanRslt{0}"
    Const szTagCleanChkNight = "CleanChkNight"
    Const szTagCleanChkDay = "CleanChkDay"

    Private Sub btnCleanSave_Click(ByVal sender As Object, ByVal e As System.EventArgs)
        Dim lstData As New List(Of String())
        lstData.Add({bccEquipID.Text, "ICTAG_LOT", bccEquipID.Text, szTagSeries, m_MoldSeries.ToString})
        lstData.Add({bccEquipID.Text, "ICTAG_LOT", bccEquipID.Text, szTagEquipID, bccEquipID.Text})
        lstData.Add({bccEquipID.Text, "ICTAG_LOT", bccEquipID.Text, szTagProcs, tabTool.Text})
        lstData.Add({bccEquipID.Text, "ICTAG_LOT", bccEquipID.Text, szTagLotNo, "ICTAG_LOT"})
        lstData.Add({bccEquipID.Text, "ICTAG_LOT", bccEquipID.Text, szTagBeginTM, tklCleanBegin.Text})
        lstData.Add({bccEquipID.Text, "ICTAG_LOT", bccEquipID.Text, szTagEndTM, tklCleanEnd.Text})

        Select Case m_MoldSeries
            Case MoldSeries.ATOM_100PF
                SaveClean1(lstData)
            Case MoldSeries.ATOM_500F
                SaveClean2(lstData)
            Case MoldSeries.ATOM_FX_FS
                SaveClean3(lstData)
            Case MoldSeries.ATOM_FZ
                SaveClean3(lstData)
            Case MoldSeries.G_LINE
                SaveClean4(lstData)
            Case MoldSeries.Y_PC
                SaveClean3(lstData)
            Case MoldSeries.YPS
                SaveClean3(lstData)
            Case MoldSeries.YPM
                SaveClean3(lstData)
            Case MoldSeries.PMC
                SaveClean7(lstData)
            Case MoldSeries.YPM_MAP
                SaveClean5(lstData)
            Case MoldSeries.YPS_MAP
                SaveClean5(lstData)
            Case MoldSeries.YPS_MAP2
                SaveClean5(lstData)
        End Select

        m_cTenken.SaveSwapMold(lstData, bccEquipID.Text, "ICTAG_LOT", "")
    End Sub

    Private Sub SaveClean1(ByVal lstData As List(Of String()))
        lstData.Add({bccEquipID.Text, "ICTAG_LOT", szTagCleanResinMin1, ltlCleanMin2.Text})
        lstData.Add({bccEquipID.Text, "ICTAG_LOT", szTagCleanResinTm1, ltlCleanTm2.Text})
        lstData.Add({bccEquipID.Text, "ICTAG_LOT", szTagCleanCelMin, ltlCleanMin3.Text})
        lstData.Add({bccEquipID.Text, "ICTAG_LOT", szTagCleanCelTm, ltlCleanTm3.Text})
        lstData.Add({bccEquipID.Text, "ICTAG_LOT", szTagCleanResinMin2, ltlCleanMin4.Text})
        lstData.Add({bccEquipID.Text, "ICTAG_LOT", szTagCleanResinMin2, ltlCleanMin4.Text})
        lstData.Add({bccEquipID.Text, "ICTAG_LOT", String.Format(szTagCleanRslt, 1), aprClean1.Text})
        lstData.Add({bccEquipID.Text, "ICTAG_LOT", szTagCleanChkDay, dncClean.Day})
        lstData.Add({bccEquipID.Text, "ICTAG_LOT", szTagCleanChkNight, dncClean.Night})
    End Sub

    Private Sub SaveClean2(ByVal lstData As List(Of String()))
        lstData.Add({bccEquipID.Text, "ICTAG_LOT", szTagCleanGumMin, ltlCleanMin1.Text})
        lstData.Add({bccEquipID.Text, "ICTAG_LOT", szTagCleanGumTm, ltlCleanTm1.Text})
        lstData.Add({bccEquipID.Text, "ICTAG_LOT", szTagCleanResinMin1, ltlCleanMin2.Text})
        lstData.Add({bccEquipID.Text, "ICTAG_LOT", szTagCleanResinTm1, ltlCleanTm2.Text})
        lstData.Add({bccEquipID.Text, "ICTAG_LOT", szTagCleanCelMin, ltlCleanMin3.Text})
        lstData.Add({bccEquipID.Text, "ICTAG_LOT", szTagCleanCelTm, ltlCleanTm3.Text})
        lstData.Add({bccEquipID.Text, "ICTAG_LOT", szTagCleanResinMin2, ltlCleanMin4.Text})
        lstData.Add({bccEquipID.Text, "ICTAG_LOT", szTagCleanResinMin2, ltlCleanMin4.Text})
        lstData.Add({bccEquipID.Text, "ICTAG_LOT", String.Format(szTagCleanRslt, 1), aprClean1.Text})
        lstData.Add({bccEquipID.Text, "ICTAG_LOT", szTagCleanChkDay, dncClean.Day})
        lstData.Add({bccEquipID.Text, "ICTAG_LOT", szTagCleanChkNight, dncClean.Night})
    End Sub

    Private Sub SaveClean3(ByVal lstData As List(Of String()))
        lstData.Add({bccEquipID.Text, "ICTAG_LOT", szTagCleanGumMin, ltlCleanMin1.Text})
        lstData.Add({bccEquipID.Text, "ICTAG_LOT", szTagCleanGumTm, ltlCleanTm1.Text})
        lstData.Add({bccEquipID.Text, "ICTAG_LOT", szTagCleanResinMin1, ltlCleanMin2.Text})
        lstData.Add({bccEquipID.Text, "ICTAG_LOT", szTagCleanResinTm1, ltlCleanTm2.Text})
        lstData.Add({bccEquipID.Text, "ICTAG_LOT", szTagCleanCelMin, ltlCleanMin3.Text})
        lstData.Add({bccEquipID.Text, "ICTAG_LOT", szTagCleanCelTm, ltlCleanTm3.Text})
        lstData.Add({bccEquipID.Text, "ICTAG_LOT", szTagCleanResinMin2, ltlCleanMin4.Text})
        lstData.Add({bccEquipID.Text, "ICTAG_LOT", szTagCleanResinMin2, ltlCleanMin4.Text})
        lstData.Add({bccEquipID.Text, "ICTAG_LOT", String.Format(szTagCleanRslt, 1), aprClean1.Text})
        lstData.Add({bccEquipID.Text, "ICTAG_LOT", String.Format(szTagCleanRslt, 2), aprClean2.Text})
        lstData.Add({bccEquipID.Text, "ICTAG_LOT", String.Format(szTagCleanRslt, 3), aprClean3.Text})
        lstData.Add({bccEquipID.Text, "ICTAG_LOT", String.Format(szTagCleanRslt, 4), aprClean4.Text})
        lstData.Add({bccEquipID.Text, "ICTAG_LOT", szTagCleanChkDay, dncClean.Day})
        lstData.Add({bccEquipID.Text, "ICTAG_LOT", szTagCleanChkNight, dncClean.Night})
    End Sub

    Private Sub SaveClean4(ByVal lstData As List(Of String()))
        lstData.Add({bccEquipID.Text, "ICTAG_LOT", szTagCleanResinMin1, ltlCleanMin2.Text})
        lstData.Add({bccEquipID.Text, "ICTAG_LOT", szTagCleanResinTm1, ltlCleanTm2.Text})
        lstData.Add({bccEquipID.Text, "ICTAG_LOT", szTagCleanCelMin, ltlCleanMin3.Text})
        lstData.Add({bccEquipID.Text, "ICTAG_LOT", szTagCleanCelTm, ltlCleanTm3.Text})
        lstData.Add({bccEquipID.Text, "ICTAG_LOT", szTagCleanResinMin2, ltlCleanMin4.Text})
        lstData.Add({bccEquipID.Text, "ICTAG_LOT", szTagCleanResinMin2, ltlCleanMin4.Text})
        lstData.Add({bccEquipID.Text, "ICTAG_LOT", String.Format(szTagCleanRslt, 1), aprClean1.Text})
        lstData.Add({bccEquipID.Text, "ICTAG_LOT", String.Format(szTagCleanRslt, 2), aprClean2.Text})
        lstData.Add({bccEquipID.Text, "ICTAG_LOT", String.Format(szTagCleanRslt, 3), aprClean3.Text})
        lstData.Add({bccEquipID.Text, "ICTAG_LOT", String.Format(szTagCleanRslt, 4), aprClean4.Text})
        lstData.Add({bccEquipID.Text, "ICTAG_LOT", szTagCleanChkDay, dncClean.Day})
        lstData.Add({bccEquipID.Text, "ICTAG_LOT", szTagCleanChkNight, dncClean.Night})
    End Sub

    Private Sub SaveClean5(ByVal lstData As List(Of String()))
        lstData.Add({bccEquipID.Text, "ICTAG_LOT", szTagCleanResinMin1, ltlCleanMin2.Text})
        lstData.Add({bccEquipID.Text, "ICTAG_LOT", szTagCleanResinTm1, ltlCleanTm2.Text})
        lstData.Add({bccEquipID.Text, "ICTAG_LOT", szTagCleanCelMin, ltlCleanMin3.Text})
        lstData.Add({bccEquipID.Text, "ICTAG_LOT", szTagCleanCelTm, ltlCleanTm3.Text})
        lstData.Add({bccEquipID.Text, "ICTAG_LOT", szTagCleanResinMin2, ltlCleanMin4.Text})
        lstData.Add({bccEquipID.Text, "ICTAG_LOT", szTagCleanResinMin2, ltlCleanMin4.Text})
        lstData.Add({bccEquipID.Text, "ICTAG_LOT", String.Format(szTagCleanRslt, 1), aprClean1.Text})
        lstData.Add({bccEquipID.Text, "ICTAG_LOT", String.Format(szTagCleanRslt, 2), aprClean2.Text})
        lstData.Add({bccEquipID.Text, "ICTAG_LOT", szTagCleanChkDay, dncClean.Day})
        lstData.Add({bccEquipID.Text, "ICTAG_LOT", szTagCleanChkNight, dncClean.Night})
    End Sub

    Private Sub SaveClean6(ByVal lstData As List(Of String()))
        lstData.Add({bccEquipID.Text, "ICTAG_LOT", szTagCleanResinMin1, ltlCleanMin2.Text})
        lstData.Add({bccEquipID.Text, "ICTAG_LOT", szTagCleanResinTm1, ltlCleanTm2.Text})
        lstData.Add({bccEquipID.Text, "ICTAG_LOT", szTagCleanCelMin, ltlCleanMin3.Text})
        lstData.Add({bccEquipID.Text, "ICTAG_LOT", szTagCleanCelTm, ltlCleanTm3.Text})
        lstData.Add({bccEquipID.Text, "ICTAG_LOT", szTagCleanResinMin2, ltlCleanMin4.Text})
        lstData.Add({bccEquipID.Text, "ICTAG_LOT", szTagCleanResinMin2, ltlCleanMin4.Text})
        lstData.Add({bccEquipID.Text, "ICTAG_LOT", String.Format(szTagCleanRslt, 1), aprClean1.Text})
        lstData.Add({bccEquipID.Text, "ICTAG_LOT", String.Format(szTagCleanRslt, 2), aprClean2.Text})
        lstData.Add({bccEquipID.Text, "ICTAG_LOT", String.Format(szTagCleanRslt, 3), aprClean3.Text})
        lstData.Add({bccEquipID.Text, "ICTAG_LOT", szTagCleanChkDay, dncClean.Day})
        lstData.Add({bccEquipID.Text, "ICTAG_LOT", szTagCleanChkNight, dncClean.Night})
    End Sub

    Private Sub SaveClean7(ByVal lstData As List(Of String()))
        lstData.Add({bccEquipID.Text, "ICTAG_LOT", szTagCleanChkDay, dncClean.Day})
        lstData.Add({bccEquipID.Text, "ICTAG_LOT", szTagCleanChkNight, dncClean.Night})
    End Sub

#End Region

#End Region

#Region "CEL-RP"

#Region "表示内容"
    Private Sub SetTabCelRp()

        Select Case m_MoldSeries
            Case MoldSeries.ATOM_100PF
            Case MoldSeries.ATOM_500F
            Case MoldSeries.ATOM_FX_FS
            Case MoldSeries.ATOM_FZ
            Case MoldSeries.G_LINE
            Case MoldSeries.Y_PC
            Case MoldSeries.YPM
            Case MoldSeries.YPS
            Case MoldSeries.PMC
                tabCelRp.Cursor = Cursors.No
            Case MoldSeries.YPM_MAP
            Case MoldSeries.YPS_MAP
            Case MoldSeries.YPS_MAP2
        End Select
    End Sub

#End Region

#Region "動作"

    Private tklCelRp As TenKeyLabel

    Private Sub LiteralLabelCelRp_Click(ByVal sender As Object, ByVal e As EventArgs)
        Dim ltl As LiteralLabel = CType(sender, LiteralLabel)
        If Not IsNothing(tklCelRp) Then
            tklCelRp.EndEdit()
            If tklCelRp.Parent.Name.Equals(ltl.Name) Then
                tklCelRp = Nothing
                IncDecCelRp.ClearLabel()
                IncDecCelRp.Enabled = False
                Exit Sub
            End If
        End If
        tklCelRp = ltl.InputLabel
        IncDecCelRp.Enabled = True
        IncDecCelRp.SetLabel(tklCelRp)
    End Sub

    Private Sub tabCelRp_Leave(ByVal sender As Object, ByVal e As System.EventArgs) Handles tabCelRp.Leave
        If Not IsNothing(tklCelRp) Then
            tklCelRp.EndEdit()
        End If
    End Sub

    Private Sub tabCelRp_LostFocus(ByVal sender As Object, ByVal e As System.EventArgs) Handles tabCelRp.LostFocus
        If Not IsNothing(tklCelRp) Then
            tklCelRp.EndEdit()
        End If
    End Sub
#End Region

#Region "初期化"
    Private Sub InitTabCelRp()
        AddHandler tklCelRpBegin.Click, AddressOf tklDate_Click
        AddHandler tklCelRpEnd.Click, AddressOf tklDate_Click

        AddHandler aprCelRp.Click, AddressOf AppearenceResult_Click

        AddHandler ltlCelRpMin3.Click, AddressOf LiteralLabel_Click
        AddHandler ltlCelRpMin4.Click, AddressOf LiteralLabel_Click

        AddHandler ltlCelRpTM3.Click, AddressOf LiteralLabelCelRp_Click
        AddHandler ltlCelRpTM4.Click, AddressOf LiteralLabelCelRp_Click

        SetTabCelRp()
    End Sub
#End Region

#Region "保存"

    Const szTagCelRpMin = "CelRpMin"
    Const szTagCelRpTm = "CelRpTm"
    Const szTagCelRpResinMin = "CelRpResinMin"
    Const szTagCelRpResinTm = "CelRpResinTm"
    Const szTagCelRpRslt = "CelRpRslt"

    Private Sub btnCelRpSave_Click(ByVal sender As Object, ByVal e As System.EventArgs)
        Dim lstData As New List(Of String())
        lstData.Add({bccEquipID.Text, "ICTAG_LOT", bccEquipID.Text, szTagSeries, m_MoldSeries.ToString})
        lstData.Add({bccEquipID.Text, "ICTAG_LOT", bccEquipID.Text, szTagEquipID, bccEquipID.Text})
        lstData.Add({bccEquipID.Text, "ICTAG_LOT", bccEquipID.Text, szTagProcs, tabTool.Text})
        lstData.Add({bccEquipID.Text, "ICTAG_LOT", bccEquipID.Text, szTagLotNo, "ICTAG_LOT"})
        lstData.Add({bccEquipID.Text, "ICTAG_LOT", bccEquipID.Text, szTagBeginTM, tklCelRpBegin.Text})
        lstData.Add({bccEquipID.Text, "ICTAG_LOT", bccEquipID.Text, szTagEndTM, tklCelRpEnd.Text})

        Select Case m_MoldSeries
            Case MoldSeries.ATOM_100PF
            Case MoldSeries.ATOM_500F
            Case MoldSeries.ATOM_FX_FS
            Case MoldSeries.ATOM_FZ
            Case MoldSeries.G_LINE
            Case MoldSeries.Y_PC
            Case MoldSeries.YPM
            Case MoldSeries.YPS
            Case MoldSeries.PMC
                Exit Sub
            Case MoldSeries.YPM_MAP
            Case MoldSeries.YPS_MAP
            Case MoldSeries.YPS_MAP2
        End Select

        SaveCelRp(lstData)

        m_cTenken.SaveSwapMold(lstData, bccEquipID.Text, "ICTAG_LOT", "")
    End Sub

    Private Sub SaveCelRp(ByVal lstData As List(Of String()))
        lstData.Add({bccEquipID.Text, "ICTAG_LOT", bccEquipID.Text, szTagCelRpMin, ltlCelRpMin3.Text})
        lstData.Add({bccEquipID.Text, "ICTAG_LOT", bccEquipID.Text, szTagCelRpTm, ltlCelRpTM3.Text})
        lstData.Add({bccEquipID.Text, "ICTAG_LOT", bccEquipID.Text, szTagCelRpResinMin, ltlCelRpMin4.Text})
        lstData.Add({bccEquipID.Text, "ICTAG_LOT", bccEquipID.Text, szTagCelRpResinTm, ltlCelRpTM4.Text})
        lstData.Add({bccEquipID.Text, "ICTAG_LOT", bccEquipID.Text, szTagCelRpRslt, aprCelRp.Text})
    End Sub

#End Region

#End Region

#Region "X線"

#Region "表示内容"
    Private Sub SetTabXray()
        Select Case m_MoldSeries
            Case MoldSeries.ATOM_100PF
            Case MoldSeries.ATOM_500F
            Case MoldSeries.ATOM_FX_FS
            Case MoldSeries.ATOM_FZ
            Case MoldSeries.G_LINE
            Case MoldSeries.Y_PC
            Case MoldSeries.YPM
            Case MoldSeries.YPS
            Case MoldSeries.PMC
            Case MoldSeries.YPM_MAP
            Case MoldSeries.YPS_MAP
            Case MoldSeries.YPS_MAP2
        End Select
    End Sub

#End Region

#Region "動作"

    Private Sub btnXrayOK_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
        Dim btn As Button = CType(sender, Button)
        Dim fIsOK As Boolean = CBool(btn.Tag)

        If fIsOK Then
            btn.BackColor = CELL_COLOR_CONTROL
            btn.UseVisualStyleBackColor = True
            btn.Tag = False.ToString
        Else
            btn.BackColor = Color.Lime
            btn.Tag = True.ToString
        End If
    End Sub
#End Region

#Region "初期化"
    Private Sub InitTabXray()
        AddHandler btnXrayOK1.Click, AddressOf btnXrayOK_Click
        AddHandler btnXrayOK2.Click, AddressOf btnXrayOK_Click
        AddHandler btnXrayOK3.Click, AddressOf btnXrayOK_Click

        AddHandler aprXray1.Click, AddressOf AppearenceResult_Click
        AddHandler aprXray2.Click, AddressOf AppearenceResult_Click
        AddHandler aprXray3.Click, AddressOf AppearenceResult_Click

        SetTabXray()
    End Sub
#End Region

#Region "保存"

    Const szTagXraySaveTM = "XraySaveTM"
    Const szTagXrayEquipID = "XrayEquipID"
    Const szTagXrayEarlyLot = "XrayEarlyLot"
    Const szTagXrayEarlyRslt = "XrayEarlyRslt"
    Const szTagXrayEarlyConf = "XrayEarlyConf"
    Const szTagXrayLateLot = "XrayLateLot"
    Const szTagXrayLateRslt = "XrayLateRslt"
    Const szTagXrayLateConf = "XrayLateConf"
    Const szTagXrayNightLot = "XrayNightLot"
    Const szTagXrayNightRslt = "XrayNightRslt"
    Const szTagXrayNightConf = "XrayNightConf"

    Private Sub btnXraySave_Click(ByVal sender As Object, ByVal e As System.EventArgs)
        Select Case m_MoldSeries
            Case MoldSeries.ATOM_100PF
            Case MoldSeries.ATOM_500F
            Case MoldSeries.ATOM_FX_FS
            Case MoldSeries.ATOM_FZ
            Case MoldSeries.G_LINE
                Dim lstData As New List(Of String())
                lstData.Add({bccEquipID.Text, "ICTAG_LOT", bccEquipID.Text, szTagSeries, m_MoldSeries.ToString})
                lstData.Add({bccEquipID.Text, "ICTAG_LOT", bccEquipID.Text, szTagEquipID, bccEquipID.Text})
                lstData.Add({bccEquipID.Text, "ICTAG_LOT", bccEquipID.Text, szTagProcs, tabTool.Text})
                lstData.Add({bccEquipID.Text, "ICTAG_LOT", bccEquipID.Text, szTagLotNo, "ICTAG_LOT"})

                SaveXray(lstData)

                m_cTenken.SaveSwapMold(lstData, bccEquipID.Text, "ICTAG_LOT", "")

            Case MoldSeries.Y_PC
            Case MoldSeries.YPM
            Case MoldSeries.YPS
            Case MoldSeries.PMC
            Case MoldSeries.YPM_MAP
            Case MoldSeries.YPS_MAP
            Case MoldSeries.YPS_MAP2
        End Select
    End Sub

    Private Sub SaveXray(ByVal lstData As List(Of String()))
        lstData.Add({bccEquipID.Text, "ICTAG_LOT", bccEquipID.Text, szTagXraySaveTM, tabTool.Text})
        lstData.Add({bccEquipID.Text, "ICTAG_LOT", bccEquipID.Text, szTagXrayEquipID, bccEquipID.Text})
        lstData.Add({bccEquipID.Text, "ICTAG_LOT", bccEquipID.Text, szTagXrayEarlyLot, bccXray1.Text})
        lstData.Add({bccEquipID.Text, "ICTAG_LOT", bccEquipID.Text, szTagXrayEarlyRslt, aprXray1.Text})
        lstData.Add({bccEquipID.Text, "ICTAG_LOT", bccEquipID.Text, szTagXrayEarlyConf, IIf(CBool(btnXrayOK1.Tag), "確認済み", "未確認")})
        lstData.Add({bccEquipID.Text, "ICTAG_LOT", bccEquipID.Text, szTagXrayLateLot, bccXray2.Text})
        lstData.Add({bccEquipID.Text, "ICTAG_LOT", bccEquipID.Text, szTagXrayLateRslt, aprXray2.Text})
        lstData.Add({bccEquipID.Text, "ICTAG_LOT", bccEquipID.Text, szTagXrayLateConf, IIf(CBool(btnXrayOK2.Tag), "確認済み", "未確認")})
        lstData.Add({bccEquipID.Text, "ICTAG_LOT", bccEquipID.Text, szTagXrayNightLot, bccXray3.Text})
        lstData.Add({bccEquipID.Text, "ICTAG_LOT", bccEquipID.Text, szTagXrayNightRslt, aprXray3.Text})
        lstData.Add({bccEquipID.Text, "ICTAG_LOT", bccEquipID.Text, szTagXrayNightConf, IIf(CBool(btnXrayOK3.Tag), "確認済み", "未確認")})
    End Sub

#End Region

#End Region

#Region "ピン数切替"

#Region "表示内容"
    Private Sub SetTabPin()

        Select Case m_MoldSeries
            Case MoldSeries.ATOM_100PF
            Case MoldSeries.ATOM_500F
            Case MoldSeries.ATOM_FX_FS
            Case MoldSeries.ATOM_FZ
            Case MoldSeries.G_LINE
            Case MoldSeries.Y_PC
            Case MoldSeries.YPM
            Case MoldSeries.YPS
            Case MoldSeries.PMC
            Case MoldSeries.YPM_MAP
            Case MoldSeries.YPS_MAP
            Case MoldSeries.YPS_MAP2
        End Select
    End Sub

#End Region

#Region "動作"
    Private Sub btnPinBack_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnPinBack.Click
        panelPinNG.Visible = True
        panelPin.Location = New Point(3.3)
        panelPin.Size = New Size(972, 469)
        panelPin.Visible = True
        btnPinBack.Visible = False
        btnPinNG.Visible = True
    End Sub

    Private Sub btnPinNG_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnPinNG.Click
        panelPin.Visible = False
        panelPinNG.Location = New Point(3.3)
        panelPinNG.Size = New Size(972, 469)
        panelPinNG.Visible = True
        btnPinBack.Visible = True
        btnPinNG.Visible = False
    End Sub

#End Region

#Region "初期化"
    Private Sub InitTabPin()
        AddHandler ltlPinPrev.Click, AddressOf LiteralLabel_Click
        AddHandler ltlPinNew.Click, AddressOf LiteralLabel_Click

        AddHandler lblPinRslt1.Click, AddressOf LiteralLabel_Click
        AddHandler lblPinNgRslt2.Click, AddressOf LiteralLabel_Click

        AddHandler lblPinRslt3.Click, AddressOf AppearenceResult_Click
        AddHandler lblPinNgRslt3.Click, AddressOf AppearenceResult_Click

        SetTabPin()
    End Sub
#End Region

#Region "保存"

    Const szTagPinPkg = "PinPkg"
    Const szTagPinOptor = "PinOptor"
    Const szTagPinCnfmer = "PinCnfmer"
    Const szTagPinCnt1 = "PinCnt1"
    Const szTagPinCnt2 = "PinCnt2"
    Const szTagPinChgShot = "PinChgShot"
    Const szTagPinChgJudg = "PinChgJudg"
    Const szTagPinInsiteJudg = "PinInsiteJudg"
    Const szTagPinXrayRslt = "PinXrayRslt"
    Const szTagPinXrayJudg = "PinXrayJudg"
    Const szTagXrayTotalJudg = "XrayTotalJudg"
    Const szTagPinNgPtRslt = "PinNgPtRslt"
    Const szTagPinNgPtJudg = "PinNgPtJudg"
    Const szTagPinNgDmShot = "PinNgDmShot"
    Const szTagPinNgDmJudg = "PinNgDmJudg"
    Const szTagPinNgXrayRslt = "PinNgXrayRslt"
    Const szTagPinNgXrayJudg = "PinNgXrayJudg"
    Const szTagPinNgReJudg = "PinNgReJudg"

    Private Sub btnPinSave_Click(ByVal sender As Object, ByVal e As System.EventArgs)
        Dim lstData As New List(Of String())
        lstData.Add({bccEquipID.Text, "ICTAG_LOT", bccEquipID.Text, szTagSeries, m_MoldSeries.ToString})
        lstData.Add({bccEquipID.Text, "ICTAG_LOT", bccEquipID.Text, szTagEquipID, bccEquipID.Text})
        lstData.Add({bccEquipID.Text, "ICTAG_LOT", bccEquipID.Text, szTagProcs, tabTool.Text})
        lstData.Add({bccEquipID.Text, "ICTAG_LOT", bccEquipID.Text, szTagLotNo, "ICTAG_LOT"})
        lstData.Add({bccEquipID.Text, "ICTAG_LOT", bccEquipID.Text, szTagDate, tklpinDte.Text})

        Select Case m_MoldSeries
            Case MoldSeries.ATOM_100PF
            Case MoldSeries.ATOM_500F
            Case MoldSeries.ATOM_FX_FS
            Case MoldSeries.ATOM_FZ
            Case MoldSeries.G_LINE
            Case MoldSeries.Y_PC
            Case MoldSeries.YPM
            Case MoldSeries.YPS
            Case MoldSeries.PMC
            Case MoldSeries.YPM_MAP
            Case MoldSeries.YPS_MAP
            Case MoldSeries.YPS_MAP2
        End Select

        SavePin(lstData)

        m_cTenken.SaveSwapMold(lstData, bccEquipID.Text, "ICTAG_LOT", "")
    End Sub

    Private Sub SavePin(ByVal lstData As List(Of String()))
        lstData.Add({bccEquipID.Text, "ICTAG_LOT", bccEquipID.Text, szTagPinPkg, lblPinPkgNm.Text})
        lstData.Add({bccEquipID.Text, "ICTAG_LOT", bccEquipID.Text, szTagPinOptor, bccPinOptor.Text})
        lstData.Add({bccEquipID.Text, "ICTAG_LOT", bccEquipID.Text, szTagPinCnfmer, bccPinCnfrmer.Text})
        lstData.Add({bccEquipID.Text, "ICTAG_LOT", bccEquipID.Text, szTagPinCnt1, ltlPinPrev.Text})
        lstData.Add({bccEquipID.Text, "ICTAG_LOT", bccEquipID.Text, szTagPinCnt2, ltlPinNew.Text})
        lstData.Add({bccEquipID.Text, "ICTAG_LOT", bccEquipID.Text, szTagPinChgShot, lblPinRslt1.Text})
        lstData.Add({bccEquipID.Text, "ICTAG_LOT", bccEquipID.Text, szTagPinChgJudg, lblPinJudg1.Text})
        lstData.Add({bccEquipID.Text, "ICTAG_LOT", bccEquipID.Text, szTagPinInsiteJudg, lblPinJudg2.Text})
        lstData.Add({bccEquipID.Text, "ICTAG_LOT", bccEquipID.Text, szTagPinXrayRslt, lblPinRslt3.Text})
        lstData.Add({bccEquipID.Text, "ICTAG_LOT", bccEquipID.Text, szTagPinXrayJudg, lblPinJudg3.Text})
        lstData.Add({bccEquipID.Text, "ICTAG_LOT", bccEquipID.Text, szTagXrayTotalJudg, lblPinJudg4.Text})
        lstData.Add({bccEquipID.Text, "ICTAG_LOT", bccEquipID.Text, szTagPinNgPtRslt, lblPinNgRslt1.Text})
        lstData.Add({bccEquipID.Text, "ICTAG_LOT", bccEquipID.Text, szTagPinNgPtJudg, lblPinNgJudg1.Text})
        lstData.Add({bccEquipID.Text, "ICTAG_LOT", bccEquipID.Text, szTagPinNgDmShot, lblPinNgRslt2.Text})
        lstData.Add({bccEquipID.Text, "ICTAG_LOT", bccEquipID.Text, szTagPinNgDmJudg, lblPinNgJudg2.Text})
        lstData.Add({bccEquipID.Text, "ICTAG_LOT", bccEquipID.Text, szTagPinNgXrayRslt, lblPinNgRslt3.Text})
        lstData.Add({bccEquipID.Text, "ICTAG_LOT", bccEquipID.Text, szTagPinNgXrayJudg, lblPinNgJudg3.Text})
        lstData.Add({bccEquipID.Text, "ICTAG_LOT", bccEquipID.Text, szTagPinNgReJudg, lblPinNgJudg4.Text})

    End Sub

#End Region

#End Region

#Region "TB数有無CH"


#Region "表示内容"
    Private Sub SetTabTB()

        Select Case m_MoldSeries
            Case MoldSeries.ATOM_100PF
            Case MoldSeries.ATOM_500F
            Case MoldSeries.ATOM_FX_FS
            Case MoldSeries.ATOM_FZ
            Case MoldSeries.G_LINE
            Case MoldSeries.Y_PC
            Case MoldSeries.YPM
            Case MoldSeries.YPS
            Case MoldSeries.PMC
            Case MoldSeries.YPM_MAP
            Case MoldSeries.YPS_MAP
            Case MoldSeries.YPS_MAP2
        End Select
    End Sub

#End Region

#Region "動作"
    Private Sub btnTbResin_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnTbResin.Click
        panelTbResinChg.Visible = True
        panelTbShutDown.Visible = False
        panelTbStartUp.Visible = False

        panelTbResinChg.Location = New Point(0, 0)
        panelTbResinChg.Size = panelTbResinChg.Parent.Size

        btnTbCancel.Enabled = True

        lblTbResinDateTime.Text = Date.Now.ToString("yyyy/MM/dd HH:mm")
    End Sub

    Private Sub btnTbShutDown_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnTbShutDown.Click
        panelTbResinChg.Visible = False
        panelTbShutDown.Visible = True
        panelTbStartUp.Visible = False

        panelTbShutDown.Location = New Point(0, 0)
        panelTbShutDown.Size = panelTbShutDown.Parent.Size

        btnTbCancel.Enabled = True

        lblTbDownDateTime.Text = Date.Now.ToString("yyyy/MM/dd HH:mm")
    End Sub

    Private Sub btnTbStartUp_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnTbStartUp.Click
        panelTbResinChg.Visible = False
        panelTbShutDown.Visible = False
        panelTbStartUp.Visible = True

        panelTbStartUp.Location = New Point(0, 0)
        panelTbStartUp.Size = panelTbStartUp.Parent.Size

        btnTbCancel.Enabled = True

        lblTbUpDateTime.Text = Date.Now.ToString("yyyy/MM/dd HH:mm")
    End Sub

    Private Sub btnTbCancel_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnTbCancel.Click
        btnTbCancel.Enabled = False

        panelTbResinChg.Visible = False
        panelTbShutDown.Visible = False
        panelTbStartUp.Visible = False
    End Sub

    Private Sub btnSaveTB_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSaveTB.Click
        panelTbResinChg.Visible = False
        panelTbShutDown.Visible = False
        panelTbStartUp.Visible = False
    End Sub

    Private Sub btnTbChgShot_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnTbChgShot.Click
        ltlTbNewShot.Enabled = True
        ltlTbNewShot.InputLabel.BeginEdit()
    End Sub

    Private Sub tabTB_Enter(ByVal sender As Object, ByVal e As System.EventArgs) Handles tabTB.Enter
        lblTbResinDateTime.Text = Date.Now.ToString("yyyy/MM/dd HH:mm")
        lblTbDownDateTime.Text = Date.Now.ToString("yyyy/MM/dd HH:mm")
        lblTbUpDateTime.Text = Date.Now.ToString("yyyy/MM/dd HH:mm")
    End Sub

#End Region

#Region "初期化"
    Private Sub InitTabTB()
        AddHandler ltlTbNewShot.Click, AddressOf LiteralLabel_Click
        AddHandler ltlTbNewShot.InputCompleted, AddressOf TbShotChanged

        SetTabTB()
    End Sub

    Private Sub TbShotChanged(ByVal sender As Object)
        ltlFreq.Text = ltlTbNewShot.Text
    End Sub
#End Region

#Region "保存"

    Const szTagTbOldResin = "TbOldResin"
    Const szTagTbNewResin = "TbNewResin"
    Const szTagTbOprtor = "TbOprtor"
    Const szTagTbProcs = "TbProcs"
    Const szTagTbCheck = "TbCheck{0}"
    Const szTagTbDblChk = "TbDblChk{0}"
    Const szTagTbShot = "TbShot"

    Private Sub btnTbSave_Click(ByVal sender As Object, ByVal e As System.EventArgs)
        Dim lstData As New List(Of String())
        lstData.Add({bccEquipID.Text, "ICTAG_LOT", bccEquipID.Text, szTagSeries, m_MoldSeries.ToString})
        lstData.Add({bccEquipID.Text, "ICTAG_LOT", bccEquipID.Text, szTagEquipID, bccEquipID.Text})
        lstData.Add({bccEquipID.Text, "ICTAG_LOT", bccEquipID.Text, szTagProcs, tabTool.Text})
        lstData.Add({bccEquipID.Text, "ICTAG_LOT", bccEquipID.Text, szTagLotNo, "ICTAG_LOT"})

        Select Case m_MoldSeries
            Case MoldSeries.ATOM_100PF
            Case MoldSeries.ATOM_500F
            Case MoldSeries.ATOM_FX_FS
            Case MoldSeries.ATOM_FZ
            Case MoldSeries.G_LINE
            Case MoldSeries.Y_PC
            Case MoldSeries.YPM
            Case MoldSeries.YPS
            Case MoldSeries.PMC
            Case MoldSeries.YPM_MAP
            Case MoldSeries.YPS_MAP
            Case MoldSeries.YPS_MAP2
        End Select

        m_cTenken.SaveSwapMold(lstData, bccEquipID.Text, "ICTAG_LOT", "")
    End Sub

    Private Sub SaveTB(ByVal lstData As List(Of String()))
        If panelTbResinChg.Visible Then
            lstData.Add({bccEquipID.Text, "ICTAG_LOT", bccEquipID.Text, szTagDate, lblTbResinDateTime.Text})
            lstData.Add({bccEquipID.Text, "ICTAG_LOT", bccEquipID.Text, szTagTbOldResin, lblTbPrevResin.Text})
            lstData.Add({bccEquipID.Text, "ICTAG_LOT", bccEquipID.Text, szTagTbNewResin, bccTbNewResin.Text})
            lstData.Add({bccEquipID.Text, "ICTAG_LOT", bccEquipID.Text, szTagTbOprtor, bccTbResinOptor.Text})
            lstData.Add({bccEquipID.Text, "ICTAG_LOT", bccEquipID.Text, szTagTbProcs, lblTbResin.Text})
            lstData.Add({bccEquipID.Text, "ICTAG_LOT", bccEquipID.Text, String.Format(szTagTbCheck, 1), lblTbResinCheck11.Text})
            lstData.Add({bccEquipID.Text, "ICTAG_LOT", bccEquipID.Text, String.Format(szTagTbCheck, 2), lblTbResinCheck12.Text})
            lstData.Add({bccEquipID.Text, "ICTAG_LOT", bccEquipID.Text, String.Format(szTagTbCheck, 3), lblTbResinCheck13.Text})
            lstData.Add({bccEquipID.Text, "ICTAG_LOT", bccEquipID.Text, String.Format(szTagTbCheck, 4), lblTbResinCheck14.Text})
            lstData.Add({bccEquipID.Text, "ICTAG_LOT", bccEquipID.Text, String.Format(szTagTbDblChk, 1), lblTbResinCheck21.Text})
            lstData.Add({bccEquipID.Text, "ICTAG_LOT", bccEquipID.Text, String.Format(szTagTbDblChk, 2), lblTbResinCheck22.Text})
            lstData.Add({bccEquipID.Text, "ICTAG_LOT", bccEquipID.Text, String.Format(szTagTbDblChk, 3), lblTbResinCheck23.Text})
            lstData.Add({bccEquipID.Text, "ICTAG_LOT", bccEquipID.Text, String.Format(szTagTbDblChk, 4), lblTbResinCheck24.Text})
            lstData.Add({bccEquipID.Text, "ICTAG_LOT", bccEquipID.Text, szTagTbShot, ltlTbNewShot.Text})
        ElseIf panelTbShutDown.Visible Then
            lstData.Add({bccEquipID.Text, "ICTAG_LOT", bccEquipID.Text, szTagDate, lblTbDownDateTime.Text})
            lstData.Add({bccEquipID.Text, "ICTAG_LOT", bccEquipID.Text, szTagTbOprtor, bccTbDownOptor.Text})
            lstData.Add({bccEquipID.Text, "ICTAG_LOT", bccEquipID.Text, szTagTbProcs, lblTbDown.Text})
            lstData.Add({bccEquipID.Text, "ICTAG_LOT", bccEquipID.Text, String.Format(szTagTbCheck, 1), lblTbDownChk1.Text})
            lstData.Add({bccEquipID.Text, "ICTAG_LOT", bccEquipID.Text, String.Format(szTagTbCheck, 2), lblTbDownChk2.Text})
            lstData.Add({bccEquipID.Text, "ICTAG_LOT", bccEquipID.Text, String.Format(szTagTbCheck, 3), lblTbDownChk3.Text})
            lstData.Add({bccEquipID.Text, "ICTAG_LOT", bccEquipID.Text, String.Format(szTagTbCheck, 4), lblTbDownChk4.Text})
        ElseIf panelTbStartUp.Visible Then
            lstData.Add({bccEquipID.Text, "ICTAG_LOT", bccEquipID.Text, szTagDate, lblTbUpDateTime.Text})
            lstData.Add({bccEquipID.Text, "ICTAG_LOT", bccEquipID.Text, szTagTbOprtor, bccTbUpOptor.Text})
            lstData.Add({bccEquipID.Text, "ICTAG_LOT", bccEquipID.Text, szTagTbProcs, lblTbUp.Text})
            lstData.Add({bccEquipID.Text, "ICTAG_LOT", bccEquipID.Text, String.Format(szTagTbCheck, 1), lblTbUpChk1.Text})
            lstData.Add({bccEquipID.Text, "ICTAG_LOT", bccEquipID.Text, String.Format(szTagTbCheck, 2), lblTbUpChk2.Text})
            lstData.Add({bccEquipID.Text, "ICTAG_LOT", bccEquipID.Text, String.Format(szTagTbCheck, 3), lblTbUpChk3.Text})
            lstData.Add({bccEquipID.Text, "ICTAG_LOT", bccEquipID.Text, String.Format(szTagTbCheck, 4), lblTbUpChk4.Text})
        End If

    End Sub

#End Region

#End Region

#Region "実体外観来歴"

#Region "表示内容"
    Private Sub SetTabEntityHis()

        Select Case m_MoldSeries
            Case MoldSeries.ATOM_100PF
                SetTabEntityHis1()
            Case MoldSeries.ATOM_500F
                SetTabEntityHis1()
            Case MoldSeries.ATOM_FX_FS
                SetTabEntityHis1()
            Case MoldSeries.ATOM_FZ
                SetTabEntityHis1()
            Case MoldSeries.G_LINE
                SetTabEntityHis1()
            Case MoldSeries.Y_PC
                SetTabEntityHis1()
            Case MoldSeries.YPM
                SetTabEntityHis1()
            Case MoldSeries.YPS
                SetTabEntityHis1()
            Case MoldSeries.PMC
                SetTabEntityHis2()
            Case MoldSeries.YPM_MAP
                SetTabEntityHis3()
            Case MoldSeries.YPS_MAP
                SetTabEntityHis3()
            Case MoldSeries.YPS_MAP2
                SetTabEntityHis3()
        End Select
    End Sub

    Private Sub SetTabEntityHis1()
        panelEntity1_1.Visible = True
        panelEntity1_23.Visible = False
        panelEntity2_1.Visible = True
        panelEntity2_3.Visible = False

        Dim iWidth As Integer = panelEntity0.Width + panelEntity1_1.Width + panelEntity2_1.Width + panelEntity3.Width - 3
        panelEntity0.Left = (tabEntityHis.Width - iWidth) / 2
        panelEntity1_1.Left = panelEntity0.Right - 1
        panelEntity2_1.Left = panelEntity1_1.Right - 1
        panelEntity3.Left = panelEntity2_1.Right - 1

        Select Case wType
            Case WORK_TYPE.EARLY
                oncEntityDam1.Enabled = True
                oncEntityDam2.Enabled = False
                oncEntityDam3.Enabled = False
                oncEntityLead1.Enabled = True
                oncEntityLead2.Enabled = False
                oncEntityLead3.Enabled = False
                oncEntityPKG1.Enabled = True
                oncEntityPKG2.Enabled = False
                oncEntityPKG3.Enabled = False
                bccEntityOpt1.Enabled = True
                bccEntityOpt2.Enabled = False
                bccEntityOpt3.Enabled = False
            Case WORK_TYPE.LATE
                oncEntityDam1.Enabled = False
                oncEntityDam2.Enabled = True
                oncEntityDam3.Enabled = False
                oncEntityLead1.Enabled = False
                oncEntityLead2.Enabled = True
                oncEntityLead3.Enabled = False
                oncEntityPKG1.Enabled = False
                oncEntityPKG2.Enabled = True
                oncEntityPKG3.Enabled = False
                bccEntityOpt1.Enabled = False
                bccEntityOpt2.Enabled = True
                bccEntityOpt3.Enabled = False
            Case WORK_TYPE.NIGHT
                oncEntityDam1.Enabled = False
                oncEntityDam2.Enabled = False
                oncEntityDam3.Enabled = True
                oncEntityLead1.Enabled = False
                oncEntityLead2.Enabled = False
                oncEntityLead3.Enabled = True
                oncEntityPKG1.Enabled = False
                oncEntityPKG2.Enabled = False
                oncEntityPKG3.Enabled = True
                bccEntityOpt1.Enabled = False
                bccEntityOpt2.Enabled = False
                bccEntityOpt3.Enabled = True
        End Select
    End Sub

    Private Sub SetTabEntityHis2()
        panelEntity1_1.Visible = False
        panelEntity1_23.Visible = True
        panelEntity2_1.Visible = False
        panelEntity2_3.Visible = False

        Dim iWidth As Integer = panelEntity0.Width + panelEntity1_23.Width + panelEntity3.Width - 2
        panelEntity0.Left = (tabEntityHis.Width - iWidth) / 2
        panelEntity1_23.Left = panelEntity0.Right - 1
        panelEntity3.Left = panelEntity1_23.Right - 1

        Select Case wType
            Case WORK_TYPE.EARLY
                oncEntityPkgObv1.Enabled = True
                oncEntityPkgObv2.Enabled = False
                oncEntityPkgObv3.Enabled = False
                oncEntityPkgRev1.Enabled = True
                oncEntityPkgRev2.Enabled = False
                oncEntityPkgRev3.Enabled = False
                bccEntityOpt1.Enabled = True
                bccEntityOpt2.Enabled = False
                bccEntityOpt3.Enabled = False
            Case WORK_TYPE.LATE
                oncEntityPkgObv1.Enabled = False
                oncEntityPkgObv2.Enabled = True
                oncEntityPkgObv3.Enabled = False
                oncEntityPkgRev1.Enabled = False
                oncEntityPkgRev2.Enabled = True
                oncEntityPkgRev3.Enabled = False
                bccEntityOpt1.Enabled = False
                bccEntityOpt2.Enabled = True
                bccEntityOpt3.Enabled = False
            Case WORK_TYPE.NIGHT
                oncEntityPkgObv1.Enabled = False
                oncEntityPkgObv2.Enabled = False
                oncEntityPkgObv3.Enabled = True
                oncEntityPkgRev1.Enabled = False
                oncEntityPkgRev2.Enabled = False
                oncEntityPkgRev3.Enabled = True
                bccEntityOpt1.Enabled = False
                bccEntityOpt2.Enabled = False
                bccEntityOpt3.Enabled = True
        End Select
    End Sub

    Private Sub SetTabEntityHis3()
        panelEntity1_1.Visible = False
        panelEntity1_23.Visible = True
        panelEntity2_1.Visible = False
        panelEntity2_3.Visible = True

        Dim iWidth As Integer = panelEntity0.Width + panelEntity1_23.Width + panelEntity2_3.Width + panelEntity3.Width - 3
        panelEntity0.Left = (tabEntityHis.Width - iWidth) / 2
        panelEntity1_23.Left = panelEntity0.Right - 1
        panelEntity2_3.Left = panelEntity1_23.Right - 1
        panelEntity3.Left = panelEntity2_3.Right - 1

        Select Case wType
            Case WORK_TYPE.EARLY
                oncEntityPkgObv1.Enabled = True
                oncEntityPkgObv2.Enabled = False
                oncEntityPkgObv3.Enabled = False
                oncEntityPkgRev1.Enabled = True
                oncEntityPkgRev2.Enabled = False
                oncEntityPkgRev3.Enabled = False
                oncEntityNoPkg1.Enabled = True
                oncEntityNoPkg2.Enabled = False
                oncEntityNoPkg3.Enabled = False
                oncEntityAdsorpt1.Enabled = True
                oncEntityAdsorpt2.Enabled = False
                oncEntityAdsorpt3.Enabled = False
                oncEntityClean1.Enabled = True
                oncEntityClean2.Enabled = False
                oncEntityClean3.Enabled = False
                bccEntityOpt1.Enabled = True
                bccEntityOpt2.Enabled = False
                bccEntityOpt3.Enabled = False
            Case WORK_TYPE.LATE
                oncEntityPkgObv1.Enabled = False
                oncEntityPkgObv2.Enabled = True
                oncEntityPkgObv3.Enabled = False
                oncEntityPkgRev1.Enabled = False
                oncEntityPkgRev2.Enabled = True
                oncEntityPkgRev3.Enabled = False
                oncEntityNoPkg1.Enabled = False
                oncEntityNoPkg2.Enabled = True
                oncEntityNoPkg3.Enabled = False
                oncEntityAdsorpt1.Enabled = False
                oncEntityAdsorpt2.Enabled = True
                oncEntityAdsorpt3.Enabled = False
                oncEntityClean1.Enabled = False
                oncEntityClean2.Enabled = True
                oncEntityClean3.Enabled = False
                bccEntityOpt1.Enabled = False
                bccEntityOpt2.Enabled = True
                bccEntityOpt3.Enabled = False
            Case WORK_TYPE.NIGHT
                oncEntityPkgObv1.Enabled = False
                oncEntityPkgObv2.Enabled = False
                oncEntityPkgObv3.Enabled = True
                oncEntityPkgRev1.Enabled = False
                oncEntityPkgRev2.Enabled = False
                oncEntityPkgRev3.Enabled = True
                oncEntityNoPkg1.Enabled = False
                oncEntityNoPkg2.Enabled = False
                oncEntityNoPkg3.Enabled = True
                oncEntityAdsorpt1.Enabled = False
                oncEntityAdsorpt2.Enabled = False
                oncEntityAdsorpt3.Enabled = True
                oncEntityClean1.Enabled = False
                oncEntityClean2.Enabled = False
                oncEntityClean3.Enabled = True
                bccEntityOpt1.Enabled = False
                bccEntityOpt2.Enabled = False
                bccEntityOpt3.Enabled = True
        End Select
    End Sub

#End Region

#Region "初期化"
    Const EARLY_HOUR As String = "0615"
    Const LATE_HOUR As String = "1415"
    Const NIGHT_HOUR As String = "2215"
    Const HOUR_FORMAT As String = "HHmm"

    Private Enum WORK_TYPE
        EARLY
        LATE
        NIGHT
    End Enum

    Private ReadOnly WorkType() As String = {"早勤", "遅勤", "夜勤"}

    Private wType As WORK_TYPE

    Private Sub InitTabEntity()
        Dim iNow As Integer = CInt(DateTime.Now.ToString(HOUR_FORMAT))
        If iNow >= CInt(NIGHT_HOUR) Then
            wType = WORK_TYPE.NIGHT
        ElseIf iNow >= CInt(LATE_HOUR) Then
            wType = WORK_TYPE.LATE
        Else
            wType = WORK_TYPE.EARLY
        End If

        lblEntityWorkTime.Text = WorkType(wType)

        SetTabEntityHis()
    End Sub
#End Region

#Region "保存"

    Const szTagEntityWork = "EntityWork"
    Const szTagEntityDam = "EntityDam"
    Const szTagEntityLead = "EntityLead"
    Const szTagEntityPkg = "EntityPkg"
    Const szTagEntityPkgObv = "EntityPkgObv"
    Const szTagEntityPkgRev = "EntityPkgRev"
    Const szTagEntityNoFrm = "EntityNoFrm"
    Const szTagEntityAbs = "EntityAbs"
    Const szTagEntityClean = "EntityClean"
    Const szTagEntityOprtor = "EntityOprtor"

    Private Sub btnEntitySave_Click(ByVal sender As Object, ByVal e As System.EventArgs)
        Dim lstData As New List(Of String())
        lstData.Add({bccEquipID.Text, "ICTAG_LOT", bccEquipID.Text, szTagSeries, m_MoldSeries.ToString})
        lstData.Add({bccEquipID.Text, "ICTAG_LOT", bccEquipID.Text, szTagEquipID, bccEquipID.Text})
        lstData.Add({bccEquipID.Text, "ICTAG_LOT", bccEquipID.Text, szTagProcs, tabTool.Text})
        lstData.Add({bccEquipID.Text, "ICTAG_LOT", bccEquipID.Text, szTagDate, ""})
        lstData.Add({bccEquipID.Text, "ICTAG_LOT", bccEquipID.Text, szTagEntityWork, lblEntityWorkTime.Text})

        Select Case wType
            Case WORK_TYPE.EARLY
                lstData.Add({bccEquipID.Text, "ICTAG_LOT", bccEquipID.Text, szTagLotNo, lblEntityLot1.Text})
            Case WORK_TYPE.LATE
                lstData.Add({bccEquipID.Text, "ICTAG_LOT", bccEquipID.Text, szTagLotNo, lblEntityLot2.Text})
            Case WORK_TYPE.NIGHT
                lstData.Add({bccEquipID.Text, "ICTAG_LOT", bccEquipID.Text, szTagLotNo, lblEntityLot3.Text})
        End Select

        Select Case m_MoldSeries
            Case MoldSeries.ATOM_100PF
                SaveEntity1(lstData)
            Case MoldSeries.ATOM_500F
                SaveEntity1(lstData)
            Case MoldSeries.ATOM_FX_FS
                SaveEntity1(lstData)
            Case MoldSeries.ATOM_FZ
                SaveEntity1(lstData)
            Case MoldSeries.G_LINE
                SaveEntity1(lstData)
            Case MoldSeries.Y_PC
                SaveEntity1(lstData)
            Case MoldSeries.YPM
                SaveEntity1(lstData)
            Case MoldSeries.YPS
                SaveEntity1(lstData)
            Case MoldSeries.PMC
                SaveEntity2(lstData)
            Case MoldSeries.YPM_MAP
                SaveEntity3(lstData)
            Case MoldSeries.YPS_MAP
                SaveEntity3(lstData)
            Case MoldSeries.YPS_MAP2
                SaveEntity3(lstData)
        End Select

        m_cTenken.SaveSwapMold(lstData, bccEquipID.Text, "ICTAG_LOT", "")
    End Sub

    Private Sub SaveEntity1(ByVal lstData As List(Of String()))
        Select Case wType
            Case WORK_TYPE.EARLY
                lstData.Add({bccEquipID.Text, "ICTAG_LOT", bccEquipID.Text, szTagEntityDam, oncEntityDam1.Text})
                lstData.Add({bccEquipID.Text, "ICTAG_LOT", bccEquipID.Text, szTagEntityLead, oncEntityLead1.Text})
                lstData.Add({bccEquipID.Text, "ICTAG_LOT", bccEquipID.Text, szTagEntityPkg, oncEntityPKG1.Text})
                lstData.Add({bccEquipID.Text, "ICTAG_LOT", bccEquipID.Text, szTagEntityOprtor, bccEntityOpt1.Text})
            Case WORK_TYPE.LATE
                lstData.Add({bccEquipID.Text, "ICTAG_LOT", bccEquipID.Text, szTagEntityDam, oncEntityDam2.Text})
                lstData.Add({bccEquipID.Text, "ICTAG_LOT", bccEquipID.Text, szTagEntityLead, oncEntityLead2.Text})
                lstData.Add({bccEquipID.Text, "ICTAG_LOT", bccEquipID.Text, szTagEntityPkg, oncEntityPKG2.Text})
                lstData.Add({bccEquipID.Text, "ICTAG_LOT", bccEquipID.Text, szTagEntityOprtor, bccEntityOpt2.Text})
            Case WORK_TYPE.NIGHT
                lstData.Add({bccEquipID.Text, "ICTAG_LOT", bccEquipID.Text, szTagEntityDam, oncEntityDam3.Text})
                lstData.Add({bccEquipID.Text, "ICTAG_LOT", bccEquipID.Text, szTagEntityLead, oncEntityLead3.Text})
                lstData.Add({bccEquipID.Text, "ICTAG_LOT", bccEquipID.Text, szTagEntityPkg, oncEntityPKG3.Text})
                lstData.Add({bccEquipID.Text, "ICTAG_LOT", bccEquipID.Text, szTagEntityOprtor, bccEntityOpt3.Text})
        End Select
    End Sub

    Private Sub SaveEntity2(ByVal lstData As List(Of String()))
        Select Case wType
            Case WORK_TYPE.EARLY
                lstData.Add({bccEquipID.Text, "ICTAG_LOT", bccEquipID.Text, szTagEntityPkgObv, oncEntityPkgObv1.Text})
                lstData.Add({bccEquipID.Text, "ICTAG_LOT", bccEquipID.Text, szTagEntityPkgRev, oncEntityPkgRev1.Text})
                lstData.Add({bccEquipID.Text, "ICTAG_LOT", bccEquipID.Text, szTagEntityOprtor, bccEntityOpt1.Text})
            Case WORK_TYPE.LATE
                lstData.Add({bccEquipID.Text, "ICTAG_LOT", bccEquipID.Text, szTagEntityPkgObv, oncEntityPkgObv2.Text})
                lstData.Add({bccEquipID.Text, "ICTAG_LOT", bccEquipID.Text, szTagEntityPkgRev, oncEntityPkgRev2.Text})
                lstData.Add({bccEquipID.Text, "ICTAG_LOT", bccEquipID.Text, szTagEntityOprtor, bccEntityOpt2.Text})
            Case WORK_TYPE.NIGHT
                lstData.Add({bccEquipID.Text, "ICTAG_LOT", bccEquipID.Text, szTagEntityPkgObv, oncEntityPkgObv3.Text})
                lstData.Add({bccEquipID.Text, "ICTAG_LOT", bccEquipID.Text, szTagEntityPkgRev, oncEntityPkgRev3.Text})
                lstData.Add({bccEquipID.Text, "ICTAG_LOT", bccEquipID.Text, szTagEntityOprtor, bccEntityOpt3.Text})
        End Select
    End Sub

    Private Sub SaveEntity3(ByVal lstData As List(Of String()))
        Select Case wType
            Case WORK_TYPE.EARLY
                lstData.Add({bccEquipID.Text, "ICTAG_LOT", bccEquipID.Text, szTagEntityPkgObv, oncEntityPkgObv1.Text})
                lstData.Add({bccEquipID.Text, "ICTAG_LOT", bccEquipID.Text, szTagEntityPkgRev, oncEntityPkgRev1.Text})
                lstData.Add({bccEquipID.Text, "ICTAG_LOT", bccEquipID.Text, szTagEntityNoFrm, oncEntityNoPkg1.Text})
                lstData.Add({bccEquipID.Text, "ICTAG_LOT", bccEquipID.Text, szTagEntityAbs, oncEntityAdsorpt1.Text})
                lstData.Add({bccEquipID.Text, "ICTAG_LOT", bccEquipID.Text, szTagEntityClean, oncEntityClean1.Text})
                lstData.Add({bccEquipID.Text, "ICTAG_LOT", bccEquipID.Text, szTagEntityOprtor, bccEntityOpt1.Text})
            Case WORK_TYPE.LATE
                lstData.Add({bccEquipID.Text, "ICTAG_LOT", bccEquipID.Text, szTagEntityPkgObv, oncEntityPkgObv2.Text})
                lstData.Add({bccEquipID.Text, "ICTAG_LOT", bccEquipID.Text, szTagEntityPkgRev, oncEntityPkgRev2.Text})
                lstData.Add({bccEquipID.Text, "ICTAG_LOT", bccEquipID.Text, szTagEntityNoFrm, oncEntityNoPkg2.Text})
                lstData.Add({bccEquipID.Text, "ICTAG_LOT", bccEquipID.Text, szTagEntityAbs, oncEntityAdsorpt2.Text})
                lstData.Add({bccEquipID.Text, "ICTAG_LOT", bccEquipID.Text, szTagEntityClean, oncEntityClean2.Text})
                lstData.Add({bccEquipID.Text, "ICTAG_LOT", bccEquipID.Text, szTagEntityOprtor, bccEntityOpt2.Text})
            Case WORK_TYPE.NIGHT
                lstData.Add({bccEquipID.Text, "ICTAG_LOT", bccEquipID.Text, szTagEntityPkgObv, oncEntityPkgObv3.Text})
                lstData.Add({bccEquipID.Text, "ICTAG_LOT", bccEquipID.Text, szTagEntityPkgRev, oncEntityPkgRev3.Text})
                lstData.Add({bccEquipID.Text, "ICTAG_LOT", bccEquipID.Text, szTagEntityNoFrm, oncEntityNoPkg3.Text})
                lstData.Add({bccEquipID.Text, "ICTAG_LOT", bccEquipID.Text, szTagEntityAbs, oncEntityAdsorpt3.Text})
                lstData.Add({bccEquipID.Text, "ICTAG_LOT", bccEquipID.Text, szTagEntityClean, oncEntityClean3.Text})
                lstData.Add({bccEquipID.Text, "ICTAG_LOT", bccEquipID.Text, szTagEntityOprtor, bccEntityOpt3.Text})
        End Select
    End Sub

#End Region

#End Region

#Region "着工来歴"

#Region "表示内容"
    Private Sub SetTabProdHis()

        Select Case m_MoldSeries
            Case MoldSeries.ATOM_100PF
                SetTabProd1()
            Case MoldSeries.ATOM_500F
                SetTabProd1()
            Case MoldSeries.ATOM_FX_FS
                SetTabProd2()
            Case MoldSeries.ATOM_FZ
                SetTabProd2()
            Case MoldSeries.G_LINE
                SetTabProd2()
            Case MoldSeries.Y_PC
                SetTabProd2()
            Case MoldSeries.YPM
                SetTabProd2()
            Case MoldSeries.YPS
                SetTabProd2()
            Case MoldSeries.PMC
                SetTabProd3()
            Case MoldSeries.YPM_MAP
                SetTabProd2()
            Case MoldSeries.YPS_MAP
                SetTabProd4()
            Case MoldSeries.YPS_MAP2
                SetTabProd4()
        End Select
    End Sub

    Private Sub SetTabProd1()

    End Sub

    Private Sub SetTabProd2()

    End Sub

    Private Sub SetTabProd3()

    End Sub

    Private Sub SetTabProd4()

    End Sub
#End Region

#Region "動作"

    'Private Sub tabProdResin_Enter(ByVal sender As Object, ByVal e As System.EventArgs) Handles tabProdResin.Enter
    '    If dgvProdResin.IsCurrentCellDirty Then
    '        Exit Sub
    '    End If
    '    Dim dt As DataTable = m_cTenken.GetMoldProdResin(bccEquipID.Text)
    '    dgvProdResin.DataSource = dt
    'End Sub

    'Private Sub tabProdCond_Enter(ByVal sender As Object, ByVal e As System.EventArgs) Handles tabProdCond.Enter
    '    If dgvProdCond.IsCurrentCellDirty Then
    '        Exit Sub
    '    End If
    '    Dim dt As DataTable = m_cTenken.GetMoldProdCond(bccEquipID.Text)
    '    dgvProdCond.DataSource = dt
    'End Sub

    'Private Sub tabProdCh_Enter(ByVal sender As Object, ByVal e As System.EventArgs) Handles tabProdCH.Enter
    '    If dgvProdCH.IsCurrentCellDirty Then
    '        Exit Sub
    '    End If
    '    Dim dt As DataTable = m_cTenken.GetMoldProdCh(bccEquipID.Text)
    '    dgvProdCH.DataSource = dt
    'End Sub

    'Private Sub tabProdMemo_Enter(ByVal sender As Object, ByVal e As System.EventArgs) Handles tabProdMemo.Enter
    '    If dgvProdMemo.IsCurrentCellDirty Then
    '        Exit Sub
    '    End If
    '    Dim dt As DataTable = m_cTenken.GetMoldProdMemo(bccEquipID.Text)
    '    dgvProdMemo.DataSource = dt
    'End Sub

    Private Sub btnProd_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnProd.Click
        tabProd.Visible = True
        tabProd.Location = New Point(-4, 42)
        'tabProdResin.Focus()
        Dim dtResin As DataTable = m_cTenken.GetMoldProdResin(bccEquipID.Text)
        dgvProdResin.DataSource = dtResin

        Dim dtCond As DataTable = m_cTenken.GetMoldProdCond(bccEquipID.Text)
        dgvProdCond.DataSource = dtCond

        Dim dtCH As DataTable = m_cTenken.GetMoldProdCh(bccEquipID.Text)
        dgvProdCH.DataSource = dtCH

        Dim dtMemo As DataTable = m_cTenken.GetMoldProdMemo(bccEquipID.Text)
        dgvProdMemo.DataSource = dtMemo

        btnProdSave.Enabled = True
        btnProdCancel.Enabled = True
    End Sub

    Private Sub btnTB_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnTB.Click
        panelProdTB.Top = 133
        panelProdTB.Visible = True

        btnProdSave.Enabled = True
        btnProdCancel.Enabled = True
    End Sub

    Private Sub btnLam_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnLam.Click
        panelProdLam.Top = 133
        panelProdLam.Visible = True

        btnProdSave.Enabled = True
        btnProdCancel.Enabled = True
    End Sub

    Private Sub btnProdCancel_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnProdCancel.Click
        tabProd.Visible = False
        panelProdTB.Visible = False
        panelProdLam.Visible = False
        btnProdSave.Enabled = False
        btnProdCancel.Enabled = False
    End Sub

    Private Sub btnProdSave_Click_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnProdSave.Click
        tabProd.Visible = False
        panelProdTB.Visible = False
        panelProdLam.Visible = False
        btnProdSave.Enabled = False
        btnProdCancel.Enabled = False
    End Sub
#End Region

#Region "編集"
    Private Sub dgvProd_CellClick(ByVal sender As Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) _
        Handles dgvProdResin.CellClick, dgvProdCond.CellClick, dgvProdCH.CellClick, dgvProdMemo.CellClick

        Dim dgv As DataGridView = CType(sender, DataGridView)
        If e.ColumnIndex < 0 Or e.RowIndex < 0 Then
            Exit Sub
        End If
        Dim cell As DataGridViewCell = dgv.Item(e.ColumnIndex, e.RowIndex)
        'If cell.GetType = GetType(DataGridViewOkNgCell) Then
        'Dim onc As DataGridViewOkNgCell = CType(cell, DataGridViewOkNgCell)
        dgv.CurrentCell = cell
        dgv.BeginEdit(False)
        'End If
    End Sub

    Private Sub dgvProd_CellEndEdit(ByVal sender As Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) _
        Handles dgvProdResin.CellEndEdit, dgvProdCond.CellEndEdit, dgvProdCH.CellEndEdit, dgvProdMemo.CellEndEdit

        Dim dgv As DataGridView = CType(sender, DataGridView)
        dgv.ClearSelection()
    End Sub

    Private Sub dgvProd_CellMouseLeave(ByVal sender As Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) _
        Handles dgvProdResin.CellMouseLeave, dgvProdCond.CellMouseLeave, dgvProdCH.CellMouseLeave, dgvProdMemo.CellMouseLeave
        If e.ColumnIndex < 0 OrElse e.RowIndex < 0 Then
            Exit Sub
        End If

        Dim dgv As DataGridView = CType(sender, DataGridView)
        If dgv.CurrentCell.GetType = GetType(DataGridViewTenkeyCell) _
        OrElse dgv.CurrentCell.GetType = GetType(DataGridViewResultCell) Then
            'If dgv.IsCurrentCellDirty Then
            Exit Sub
            'End If
        End If
        If dgv.IsCurrentCellInEditMode Then
            dgv.EndEdit()
        End If

    End Sub

    Private Sub dgvProd_CellPainting(ByVal sender As Object, ByVal e As System.Windows.Forms.DataGridViewCellPaintingEventArgs) _
        Handles dgvProdResin.CellPainting, dgvProdCond.CellPainting, dgvProdCH.CellPainting, dgvProdMemo.CellPainting

        Dim dgv As DataGridView = CType(sender, DataGridView)

        If e.RowIndex >= 0 Then
            dgv.Rows(e.RowIndex).Height = 40
        End If

    End Sub

    Private Sub dgvProd_LostFocus(ByVal sender As Object, ByVal e As System.EventArgs) _
        Handles dgvProdResin.LostFocus, dgvProdCond.LostFocus, dgvProdCH.LostFocus, dgvProdMemo.LostFocus
        Dim dgv As DataGridView = CType(sender, DataGridView)
        If dgv.CurrentCell.GetType = GetType(DataGridViewTenkeyCell) Then
            Dim cell As DataGridViewTenkeyCell = CType(dgv.CurrentCell, DataGridViewTenkeyCell)
            dgv.Focus()
            dgv.BeginEdit(True)
        End If
        If dgv.CurrentCell.GetType = GetType(DataGridViewResultCell) Then
            Dim cell As DataGridViewResultCell = CType(dgv.CurrentCell, DataGridViewResultCell)
            dgv.Focus()
            dgv.BeginEdit(True)
        End If
    End Sub

    Private Sub dgvProdCH_Scroll(ByVal sender As Object, ByVal e As System.Windows.Forms.ScrollEventArgs) Handles dgvProdCH.Scroll
        lblProdCh.Left += e.OldValue - e.NewValue
        lblProdCel.Left += e.OldValue - e.NewValue
        lblProdCH1.Left += e.OldValue - e.NewValue
    End Sub

    Private Sub dgvProd_SelectionChanged(ByVal sender As Object, ByVal e As System.EventArgs) _
        Handles dgvProdResin.SelectionChanged, dgvProdCond.SelectionChanged, dgvProdCH.SelectionChanged, dgvProdMemo.SelectionChanged
        Dim dgv As DataGridView = CType(sender, DataGridView)
        dgv.ClearSelection()
    End Sub

#End Region

#Region "初期化"
    Private Sub InitTabProd()
        SetTabProdHis()

        Dim dt As New DataTable
        dt.Columns.Add("colConf", GetType(String))
        Dim i As Integer
        For i = 0 To 5
            Dim dr = dt.NewRow
            Select Case i Mod 3
                Case 0
                    dr(0) = OK
                Case 1
                    dr(0) = NG
                Case Else
                    dr(0) = String.Empty
            End Select
            dt.Rows.Add(dr)
        Next
        dgvProdResin.EnableHeadersVisualStyles = False
        dgvProdResin.ColumnHeadersDefaultCellStyle.BackColor = Color.LightGreen
        dgvProdResin.AutoGenerateColumns = False

        dgvProdCond.EnableHeadersVisualStyles = False
        dgvProdCond.ColumnHeadersDefaultCellStyle.BackColor = Color.LightGreen
        dgvProdCond.AutoGenerateColumns = False

        dgvProdCH.EnableHeadersVisualStyles = False
        dgvProdCH.ColumnHeadersDefaultCellStyle.BackColor = Color.LightGreen
        dgvProdCH.AutoGenerateColumns = False

        dgvProdMemo.EnableHeadersVisualStyles = False
        dgvProdMemo.ColumnHeadersDefaultCellStyle.BackColor = Color.LightGreen
        dgvProdMemo.AutoGenerateColumns = False
    End Sub
#End Region

#Region "保存"

    Private Sub btnProdSave_Click(ByVal sender As Object, ByVal e As System.EventArgs)
        Dim lstData As New List(Of String())
        lstData.Add({bccEquipID.Text, "ICTAG_LOT", bccEquipID.Text, szTagSeries, m_MoldSeries.ToString})
        lstData.Add({bccEquipID.Text, "ICTAG_LOT", bccEquipID.Text, szTagEquipID, bccEquipID.Text})
        lstData.Add({bccEquipID.Text, "ICTAG_LOT", bccEquipID.Text, szTagProcs, tabTool.Text})
        lstData.Add({bccEquipID.Text, "ICTAG_LOT", bccEquipID.Text, szTagLotNo, "ICTAG_LOT"})
        lstData.Add({bccEquipID.Text, "ICTAG_LOT", bccEquipID.Text, szTagBeginTM, ""})

        Select Case m_MoldSeries
            Case MoldSeries.ATOM_100PF
            Case MoldSeries.ATOM_500F
            Case MoldSeries.ATOM_FX_FS
            Case MoldSeries.ATOM_FZ
            Case MoldSeries.G_LINE
            Case MoldSeries.Y_PC
            Case MoldSeries.YPM
            Case MoldSeries.YPS
            Case MoldSeries.PMC
            Case MoldSeries.YPM_MAP
            Case MoldSeries.YPS_MAP
            Case MoldSeries.YPS_MAP2
        End Select

        m_cTenken.SaveSwapMold(lstData, bccEquipID.Text, "ICTAG_LOT", "")
    End Sub

    Private Sub lblPinOpr4_Paint(sender As Object, e As PaintEventArgs) Handles lblPinOpr4.Paint
        Dim graph As Graphics = e.Graphics

        Dim pen As Pen = New Pen(Color.Black, 3)

        Dim panel As Panel = CType(sender, Panel)
        graph.DrawLine(pen, 0, 0, panel.Size.Width, panel.Size.Height)

    End Sub

    Private Sub lblPinNgOpr4_Paint(sender As Object, e As PaintEventArgs) Handles lblPinNgOpr4.Paint
        Dim graph As Graphics = e.Graphics

        Dim pen As Pen = New Pen(Color.Black, 3)

        Dim panel As Panel = CType(sender, Panel)
        graph.DrawLine(pen, 0, 0, panel.Size.Width, panel.Size.Height)
    End Sub

#End Region

#End Region

End Class